public function DefaultViewsTest::testSplitListing in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php \Drupal\Tests\views_ui\Functional\DefaultViewsTest::testSplitListing()
- 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 167
Class
- DefaultViewsTest
- Tests enabling, disabling, and reverting default views via the listing page.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testSplitListing() {
// Build a re-usable xpath query.
$xpath = '//div[@id="views-entity-list"]/div[@class = :status]/table//td/text()[contains(., :title)]';
$arguments = [
':status' => 'views-list-section enabled',
':title' => 'test_view_status',
];
$this
->drupalGet('admin/structure/views');
$elements = $this
->xpath($xpath, $arguments);
$this
->assertCount(0, $elements, 'A disabled view is not found in the enabled views table.');
$arguments[':status'] = 'views-list-section disabled';
$elements = $this
->xpath($xpath, $arguments);
$this
->assertCount(1, $elements, 'A disabled view is found in the disabled views table.');
// Enable the view.
$this
->clickViewsOperationLink('Enable', '/test_view_status/');
$elements = $this
->xpath($xpath, $arguments);
$this
->assertCount(0, $elements, 'After enabling a view, it is not found in the disabled views table.');
$arguments[':status'] = 'views-list-section enabled';
$elements = $this
->xpath($xpath, $arguments);
$this
->assertCount(1, $elements, 'After enabling a view, it is found in the enabled views table.');
// 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);
}