function EntityViewsDataTest::testGetViewsDataWithNonRevisionableEntityOperations

@covers ::getViewsData

File

core/modules/views/tests/src/Unit/EntityViewsDataTest.php, line 1023

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']);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.