function DefaultViewsTest::testSplitListing

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php \Drupal\Tests\views_ui\Functional\DefaultViewsTest::testSplitListing()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php \Drupal\Tests\views_ui\Functional\DefaultViewsTest::testSplitListing()
  3. 10 core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php \Drupal\Tests\views_ui\Functional\DefaultViewsTest::testSplitListing()

Tests that enabling views moves them to the correct table.

File

core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php, line 176

Class

DefaultViewsTest
Tests enabling, disabling, and reverting default views via the listing page.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testSplitListing() : void {
    $this->drupalGet('admin/structure/views');
    $this->assertSession()
        ->elementNotExists('xpath', '//div[@id="views-entity-list"]/div[@class = "views-list-section enabled"]/table//td/text()[contains(., "test_view_status")]');
    $this->assertSession()
        ->elementsCount('xpath', '//div[@id="views-entity-list"]/div[@class = "views-list-section disabled"]/table//td/text()[contains(., "test_view_status")]', 1);
    // Enable the view.
    $this->clickViewsOperationLink('Enable', '/test_view_status/');
    $this->assertSession()
        ->elementNotExists('xpath', '//div[@id="views-entity-list"]/div[@class = "views-list-section disabled"]/table//td/text()[contains(., "test_view_status")]');
    $this->assertSession()
        ->elementsCount('xpath', '//div[@id="views-entity-list"]/div[@class = "views-list-section enabled"]/table//td/text()[contains(., "test_view_status")]', 1);
    // Attempt to disable the view by path directly, with no token.
    $this->drupalGet('admin/structure/views/view/test_view_status/disable');
    $this->assertSession()
        ->statusCodeEquals(403);
}

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