public function DisplayTest::testViewStatus

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

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTest.php, line 313
Contains \Drupal\views_ui\Tests\DisplayTest.

Class

DisplayTest

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_get_view($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.');
}