You are here

public function DisplayCRUDTest::testAddDisplay in Zircon Profile 8

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

Tests adding a display.

File

core/modules/views_ui/src/Tests/DisplayCRUDTest.php, line 36
Contains \Drupal\views_ui\Tests\DisplayCRUDTest.

Class

DisplayCRUDTest
Tests creation, retrieval, updating, and deletion of displays in the Web UI.

Namespace

Drupal\views_ui\Tests

Code

public function testAddDisplay() {

  // Show the master display.
  $this
    ->config('views.settings')
    ->set('ui.show.master_display', TRUE)
    ->save();
  $settings['page[create]'] = FALSE;
  $view = $this
    ->randomView($settings);
  $path_prefix = 'admin/structure/views/view/' . $view['id'] . '/edit';
  $this
    ->drupalGet($path_prefix);

  // Add a new display.
  $this
    ->drupalPostForm(NULL, array(), 'Add Page');
  $this
    ->assertLinkByHref($path_prefix . '/page_1', 0, 'Make sure after adding a display the new display appears in the UI');
  $this
    ->assertNoLink('Master*', 'Make sure the master display is not marked as changed.');
  $this
    ->assertLink('Page*', 0, 'Make sure the added display is marked as changed.');
  $this
    ->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/path", array(
    'path' => 'test/path',
  ), t('Apply'));
  $this
    ->drupalPostForm(NULL, array(), t('Save'));
}