function DisplayTest::testViewStatus
Same name in other branches
- 8.9.x core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testViewStatus()
- 10 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testViewStatus()
- 11.x core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testViewStatus()
Tests that the view status is correctly reflected on the edit form.
File
-
core/
modules/ views_ui/ tests/ src/ Functional/ DisplayTest.php, line 198
Class
- DisplayTest
- Tests the display UI.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testViewStatus() {
$view = $this->randomView();
$id = $view['id'];
// The view should initially have the enabled class on its form wrapper.
$this->drupalGet('admin/structure/views/view/' . $id);
$this->assertSession()
->elementExists('xpath', "//div[contains(@class, 'views-edit-view') and contains(@class, 'enabled')]");
$view = Views::getView($id);
$view->storage
->disable()
->save();
// The view should now have the disabled class on its form wrapper.
$this->drupalGet('admin/structure/views/view/' . $id);
$this->assertSession()
->elementExists('xpath', "//div[contains(@class, 'views-edit-view') and contains(@class, 'disabled')]");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.