function FieldDefinitionListenerTest::testOnFieldDefinitionUpdate

Tests on field definition update.

@legacy-covers ::onFieldDefinitionUpdate

File

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

Class

FieldDefinitionListenerTest
Tests Drupal\Core\Field\FieldDefinitionListener.

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.