function EntityTestRevisionTest::testRevisionsViewWithNoTypeOnBaseTable

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Wizard/EntityTestRevisionTest.php \Drupal\Tests\views\Functional\Wizard\EntityTestRevisionTest::testRevisionsViewWithNoTypeOnBaseTable()
  2. 8.9.x core/modules/views/tests/src/Functional/Wizard/EntityTestRevisionTest.php \Drupal\Tests\views\Functional\Wizard\EntityTestRevisionTest::testRevisionsViewWithNoTypeOnBaseTable()
  3. 10 core/modules/views/tests/src/Functional/Wizard/EntityTestRevisionTest.php \Drupal\Tests\views\Functional\Wizard\EntityTestRevisionTest::testRevisionsViewWithNoTypeOnBaseTable()

Tests creating a view of revisions where the type is not on the base table.

File

core/modules/views/tests/src/Functional/Wizard/EntityTestRevisionTest.php, line 27

Class

EntityTestRevisionTest
Tests wizard for generic revisionable entities.

Namespace

Drupal\Tests\views\Functional\Wizard

Code

public function testRevisionsViewWithNoTypeOnBaseTable() : void {
    $type = [
        'show[wizard_key]' => 'standard:entity_test_rev_revision',
    ];
    $this->drupalGet('admin/structure/views/add');
    $this->submitForm($type, 'Update "Show" choice');
    $view = [];
    $view['label'] = $this->randomMachineName(16);
    $view['id'] = $this->randomMachineName(16);
    $view['description'] = $this->randomMachineName(16);
    $view['page[create]'] = FALSE;
    $view['show[type]'] = 'entity_test_rev';
    $this->submitForm($view, 'Save and edit');
    $view_storage_controller = \Drupal::entityTypeManager()->getStorage('view');
    
    /** @var \Drupal\views\Entity\View $view */
    $view = $view_storage_controller->load($view['id']);
    $display_options = $view->getDisplay('default')['display_options'];
    // Ensure that no filters exist on 'type' since that data is not available
    // on the base table.
    $this->assertEmpty($display_options['filters']);
}

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