function EntityViewsDataTest::testRevisionTableWithoutDataTable
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsDataTest::testRevisionTableWithoutDataTable()
- 10 core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsDataTest::testRevisionTableWithoutDataTable()
- 11.x core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsDataTest::testRevisionTableWithoutDataTable()
Tests revision table without data table support.
File
-
core/
modules/ views/ tests/ src/ Unit/ EntityViewsDataTest.php, line 261
Class
- EntityViewsDataTest
- @coversDefaultClass \Drupal\views\EntityViewsData @group Views
Namespace
Drupal\Tests\views\UnitCode
public function testRevisionTableWithoutDataTable() {
$entity_type = $this->baseEntityType
->set('revision_table', 'entity_test_mulrev_revision')
->set('revision_data_table', NULL)
->set('id', 'entity_test_mulrev')
->setKey('revision', 'revision_id');
$this->viewsData
->setEntityType($entity_type);
$data = $this->viewsData
->getViewsData();
$this->assertEquals('Entity test revisions', $data['entity_test_mulrev_revision']['table']['base']['title']);
$this->assertEquals('revision_id', $data['entity_test_mulrev_revision']['table']['base']['field']);
$this->assertEquals(FALSE, $data['entity_test']['table']['entity revision']);
$this->assertEquals('entity_test_mulrev', $data['entity_test_mulrev_revision']['table']['entity type']);
$this->assertEquals(TRUE, $data['entity_test_mulrev_revision']['table']['entity revision']);
$this->assertEquals('entity_test_mulrev', $data['entity_test_mulrev_revision']['table']['entity type']);
$this->assertEquals(TRUE, $data['entity_test_mulrev_revision']['table']['entity revision']);
$this->assertEquals('Entity test revision', $data['entity_test_mulrev_revision']['table']['group']);
$this->assertEquals('entity_test', $data['entity_test']['table']['provider']);
// Ensure the join information is set up properly.
// Tests the join definition between the base and the revision table.
$revision_data = $data['entity_test_mulrev_revision'];
$this->assertCount(1, $revision_data['table']['join']);
$this->assertEquals([
'entity_test' => [
'left_field' => 'revision_id',
'field' => 'revision_id',
'type' => 'INNER',
],
], $revision_data['table']['join']);
$this->assertFalse(isset($data['data_table']));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.