You are here

public function UnsavedPreviewTest::testUnsavedPageDisplayPreview in Zircon Profile 8

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

Tests previews of unsaved new page displays.

File

core/modules/views_ui/src/Tests/UnsavedPreviewTest.php, line 51
Contains \Drupal\views_ui\Tests\UnsavedPreviewTest.

Class

UnsavedPreviewTest
Tests covering Preview of unsaved Views.

Namespace

Drupal\views_ui\Tests

Code

public function testUnsavedPageDisplayPreview() {
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);
  for ($i = 0; $i < 5; $i++) {
    $this
      ->drupalCreateNode();
  }
  $this
    ->drupalGet('admin/structure/views/view/content');
  $this
    ->assertResponse(200);
  $this
    ->drupalPostForm(NULL, [], t('Add Page'));
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/structure/views/nojs/display/content/page_2/path');
  $this
    ->assertResponse(200);
  $this
    ->drupalPostForm(NULL, [
    'path' => 'foobarbaz',
  ], t('Apply'));
  $this
    ->assertResponse(200);
  $this
    ->drupalPostForm(NULL, [], t('Update preview'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('This display has no path'));
  $this
    ->drupalGet('admin/structure/views/view/content/edit/page_2');
  $this
    ->assertResponse(200);
  $this
    ->drupalPostForm(NULL, [], t('Save'));
  $this
    ->assertResponse(200);
  $this
    ->drupalPostForm(NULL, [], t('Update preview'));
  $this
    ->assertResponse(200);
  $this
    ->assertLinkByHref('foobarbaz');
}