You are here

public function EntityViewsDataTest::testGetViewsDataWithNonRevisionableEntityOperations in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/EntityViewsDataTest.php \Drupal\Tests\views\Unit\EntityViewsDataTest::testGetViewsDataWithNonRevisionableEntityOperations()

@covers ::getViewsData

File

core/modules/views/tests/src/Unit/EntityViewsDataTest.php, line 1023
Contains \Drupal\Tests\views\Unit\EntityViewsDataTest.

Class

EntityViewsDataTest
@coversDefaultClass \Drupal\views\EntityViewsData @group Views

Namespace

Drupal\Tests\views\Unit

Code

public function testGetViewsDataWithNonRevisionableEntityOperations() {
  $this->baseEntityType
    ->setListBuilderClass('\\Drupal\\Core\\Entity\\EntityListBuilder');
  $entity_type_without_revisions = $this->baseEntityType;
  $views_data = $this->viewsData;
  $entity_type_keys = $entity_type_without_revisions
    ->getKeys();
  unset($entity_type_keys['revision']);
  $entity_type_without_revisions
    ->set('entity_keys', $entity_type_keys);
  $views_data
    ->setEntityType($entity_type_without_revisions);
  $data = $views_data
    ->getViewsData();
  $tables = [
    'entity_test',
  ];
  $this
    ->assertSame($tables, array_keys($data));
  foreach ($tables as $table_name) {
    $this
      ->assertSame('entity_operations', $data[$table_name]['operations']['field']['id']);
  }
}