You are here

public function FieldTest::testDefineOptionsWithNoOptions in Drupal 8

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

@covers ::defineOptions

File

core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php, line 137
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 testDefineOptionsWithNoOptions() {
  $definition = [
    'entity_type' => 'test_entity',
    'field_name' => 'title',
  ];
  $handler = new EntityField([], 'field', $definition, $this->entityTypeManager, $this->formatterPluginManager, $this->fieldTypePluginManager, $this->languageManager, $this->renderer, $this->entityRepository, $this->entityFieldManager);

  // Setup the entity manager to allow fetching the storage definitions.
  $title_storage = $this
    ->getBaseFieldStorage();
  $this->entityFieldManager
    ->expects($this
    ->atLeastOnce())
    ->method('getFieldStorageDefinitions')
    ->with('test_entity')
    ->willReturn([
    'title' => $title_storage,
  ]);
  $options = [];
  $handler
    ->init($this->executable, $this->display, $options);
  $this
    ->assertEquals('value', $handler->options['group_column']);
  $this
    ->assertEquals(0, $handler->options['delta_limit']);
}