function BaseFieldOverrideValidationTest::testTargetBundleMustExist
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Entity/BaseFieldOverrideValidationTest.php \Drupal\KernelTests\Core\Entity\BaseFieldOverrideValidationTest::testTargetBundleMustExist()
Tests that the target bundle of the field is checked.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BaseFieldOverrideValidationTest.php, line 50
Class
- BaseFieldOverrideValidationTest
- Tests validation of base_field_override entities.
Namespace
Drupal\KernelTests\Core\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.