You are here

public function FieldDefinitionListenerTest::testOnFieldDefinitionUpdate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 184
Contains \Drupal\Tests\Core\Field\FieldDefinitionListenerTest.

Class

FieldDefinitionListenerTest
@coversDefaultClass \Drupal\Core\Field\FieldDefinitionListener @group Field

Namespace

Drupal\Tests\Core\Field

Code

public function testOnFieldDefinitionUpdate() {
  $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
    ->setUpEntityManager([
    'test_entity_type' => $entity,
  ]);
  $this->fieldDefinitionListener
    ->onFieldDefinitionUpdate($field_definition
    ->reveal(), $field_definition
    ->reveal());
}