public function DisplayTest::testViewStatus in Drupal 9
Same name and namespace in other branches
- 8 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()
 
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')]");
}