You are here

public function FieldTest::testCalculateDependenciesWithConfiguredField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::testCalculateDependenciesWithConfiguredField()

@covers ::calculateDependencies

File

core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php, line 222
Contains \Drupal\Tests\views\Unit\Plugin\field\FieldTest.

Class

FieldTest
@coversDefaultClass \Drupal\views\Plugin\views\field\Field @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public function testCalculateDependenciesWithConfiguredField() {
  $definition = [
    'entity_type' => 'test_entity',
    'field_name' => 'body',
  ];
  $handler = new Field([], 'field', $definition, $this->entityManager, $this->formatterPluginManager, $this->fieldTypePluginManager, $this->languageManager, $this->renderer);
  $body_storage = $this
    ->getConfigFieldStorage();
  $this->entityManager
    ->expects($this
    ->atLeastOnce())
    ->method('getFieldStorageDefinitions')
    ->with('test_entity')
    ->willReturn([
    'body' => $body_storage,
  ]);
  $body_storage
    ->expects($this
    ->atLeastOnce())
    ->method('getConfigDependencyName')
    ->willReturn('field.field_storage_config.body');
  $dependencies = $handler
    ->calculateDependencies();
  $this
    ->assertEquals([
    'config' => [
      'field.field_storage_config.body',
    ],
  ], $dependencies);
}