function FieldDefinitionListenerTest::testOnFieldDefinitionUpdate

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php \Drupal\Tests\Core\Field\FieldDefinitionListenerTest::testOnFieldDefinitionUpdate()
  2. 8.9.x core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php \Drupal\Tests\Core\Field\FieldDefinitionListenerTest::testOnFieldDefinitionUpdate()
  3. 10 core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php \Drupal\Tests\Core\Field\FieldDefinitionListenerTest::testOnFieldDefinitionUpdate()

@covers ::onFieldDefinitionUpdate

File

core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php, line 178

Class

FieldDefinitionListenerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Field%21FieldDefinitionListener.php/class/FieldDefinitionListener/11.x" title="Reacts to field definition CRUD on behalf of the Entity system." class="local">\Drupal\Core\Field\FieldDefinitionListener</a> @group Field

Namespace

Drupal\Tests\Core\Field

Code

public function testOnFieldDefinitionUpdate() : void {
    $field_definition = $this->prophesize(FieldDefinitionInterface::class);
    $field_definition->getTargetEntityTypeId()
        ->willReturn('test_entity_type');
    $storage = $this->prophesize(DynamicallyFieldableEntityStorageInterface::class);
    $storage->onFieldDefinitionUpdate($field_definition->reveal(), $field_definition->reveal())
        ->shouldBeCalledTimes(1);
    $this->entityTypeManager
        ->getStorage('test_entity_type')
        ->willReturn($storage->reveal());
    $entity = $this->prophesize(EntityTypeInterface::class);
    $this->setUpEntityTypeManager([
        'test_entity_type' => $entity,
    ]);
    $this->fieldDefinitionListener
        ->onFieldDefinitionUpdate($field_definition->reveal(), $field_definition->reveal());
}

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