You are here

public function DisplayTest::testAddDisplay 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::testAddDisplay()

Tests adding a display.

File

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

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\views_ui\Tests

Code

public function testAddDisplay() {
  $view = $this
    ->randomView();
  $this
    ->assertNoText('Block');
  $this
    ->assertNoText('Block 2');
  $this
    ->drupalPostForm(NULL, [], t('Add @display', [
    '@display' => 'Block',
  ]));
  $this
    ->assertText('Block');
  $this
    ->assertNoText('Block 2');

  // Views has special form handling in views_ui_form_button_was_clicked()
  // to be able to change the submit button text via JS, this simulates what
  // the JS is doing.
  $this
    ->drupalPostForm(NULL, [], NULL, [], [], NULL, '&op=Block');
  $this
    ->assertText('Block');
  $this
    ->assertText('Block 2');
}