You are here

public function DisplayTest::testAddDisplay in Views (for Drupal 7) 8.3

Tests adding a display.

File

lib/Drupal/views/Tests/UI/DisplayTest.php, line 75
Definition of Drupal\views\Tests\UI\DisplayTest.

Class

DisplayTest
Tests the handling of displays in the UI, adding removing etc.

Namespace

Drupal\views\Tests\UI

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['name'] . '/edit';
  $this
    ->drupalGet($path_prefix);
  $this
    ->drupalPost(NULL, array(), t('Save'));

  // 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.');
}