function FieldConfigValidationTest::testTargetBundleMustExist
Same name in other branches
- 11.x core/modules/field/tests/src/Kernel/Entity/FieldConfigValidationTest.php \Drupal\Tests\field\Kernel\Entity\FieldConfigValidationTest::testTargetBundleMustExist()
Tests that the target bundle of the field is checked.
File
-
core/
modules/ field/ tests/ src/ Kernel/ Entity/ FieldConfigValidationTest.php, line 105
Class
- FieldConfigValidationTest
- Tests validation of field_config entities.
Namespace
Drupal\Tests\field\Kernel\EntityCode
public function testTargetBundleMustExist() : void {
$this->entity
->set('bundle', 'nope');
$this->assertValidationErrors([
'' => "The 'bundle' property cannot be changed.",
'bundle' => "The 'nope' bundle does not exist on the 'node' entity type.",
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.