public function FieldDefaultTokenBasicTest::testCallbackExistingField in Field default token 8
Tests that the default value callback is registered for an existing field.
File
- tests/
src/ Kernel/ FieldDefaultTokenBasicTest.php, line 54
Class
- FieldDefaultTokenBasicTest
- Tests that tokens in field default values get replaced correctly.
Namespace
Drupal\Tests\field_default_token\KernelCode
public function testCallbackExistingField() {
$field = $this
->createField();
$field
->save();
$this
->assertEquals('', $field
->getDefaultValueCallback());
$field
->setDefaultValue('This is the site name: [site:name]')
->save();
$this
->assertEquals('field_default_token_default_value_callback', $field
->getDefaultValueCallback());
}