You are here

public function FieldTest::testConstruct in Drupal 9

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

@covers ::__construct

File

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

Class

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

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public function testConstruct() {
  $definition = [
    'entity_type' => 'test_entity',
    // Just provide 'entity field' as definition. This is how EntityViewsData
    // provides it.
    'entity field' => 'title',
  ];
  $handler = new EntityField([], 'field', $definition, $this->entityTypeManager, $this->formatterPluginManager, $this->fieldTypePluginManager, $this->languageManager, $this->renderer, $this->entityRepository, $this->entityFieldManager);
  $this
    ->assertEquals('title', $handler->definition['field_name']);
}