function BaseFieldOverrideValidationTest::testFieldTypePluginIsValidated

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Entity/BaseFieldOverrideValidationTest.php \Drupal\KernelTests\Core\Entity\BaseFieldOverrideValidationTest::testFieldTypePluginIsValidated()

Tests that the field type plugin's existence is validated.

File

core/tests/Drupal/KernelTests/Core/Entity/BaseFieldOverrideValidationTest.php, line 77

Class

BaseFieldOverrideValidationTest
Tests validation of base_field_override entities.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testFieldTypePluginIsValidated() : void {
    // The `field_type` property is immutable, so we need to clone the entity in
    // order to cleanly change its field_type property to some invalid value.
    $this->entity = $this->entity
        ->createDuplicate()
        ->set('field_type', 'invalid');
    $this->assertValidationErrors([
        'field_type' => "The 'invalid' plugin does not exist.",
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.