public function DisplayTest::testAddDisplay

Tests adding a display.

File

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

Class

DisplayTest

Namespace

Drupal\views_ui\Tests

Code

public function testAddDisplay() {

  // Show the master display.
  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
    ->drupalPost(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*', 0, 'Make sure the master display is not marked as changed.');
  $this
    ->assertLink('Page*', 0, 'Make sure the added display is marked as changed.');
}