You are here

public function DisplayTest::testViewStatus in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/DisplayTest.php \Drupal\views_ui\Tests\DisplayTest::testViewStatus()

Tests that the view status is correctly reflected on the edit form.

File

core/modules/views_ui/src/Tests/DisplayTest.php, line 231
Contains \Drupal\views_ui\Tests\DisplayTest.

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\views_ui\Tests

Code

public function testViewStatus() {
  $view = $this
    ->randomView();
  $id = $view['id'];

  // The view should initially have the enabled class on it's form wrapper.
  $this
    ->drupalGet('admin/structure/views/view/' . $id);
  $elements = $this
    ->xpath('//div[contains(@class, :edit) and contains(@class, :status)]', array(
    ':edit' => 'views-edit-view',
    ':status' => 'enabled',
  ));
  $this
    ->assertTrue($elements, 'The enabled class was found on the form wrapper');
  $view = Views::getView($id);
  $view->storage
    ->disable()
    ->save();
  $this
    ->drupalGet('admin/structure/views/view/' . $id);
  $elements = $this
    ->xpath('//div[contains(@class, :edit) and contains(@class, :status)]', array(
    ':edit' => 'views-edit-view',
    ':status' => 'disabled',
  ));
  $this
    ->assertTrue($elements, 'The disabled class was found on the form wrapper.');
}