You are here

protected function DisplayPathTest::doBasicPathUITest in Zircon Profile 8

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

Tests basic functionality in configuring a view.

1 call to DisplayPathTest::doBasicPathUITest()
DisplayPathTest::testPathUI in core/modules/views_ui/src/Tests/DisplayPathTest.php
Runs the tests.

File

core/modules/views_ui/src/Tests/DisplayPathTest.php, line 50
Contains \Drupal\views_ui\Tests\DisplayPathTest.

Class

DisplayPathTest
Tests the UI of generic display path plugin.

Namespace

Drupal\views_ui\Tests

Code

protected function doBasicPathUITest() {
  $this
    ->drupalGet('admin/structure/views/view/test_view');

  // Add a new page display and check the appearing text.
  $this
    ->drupalPostForm(NULL, array(), 'Add Page');
  $this
    ->assertText(t('No path is set'), 'The right text appears if no path was set.');
  $this
    ->assertNoLink(t('View @display', array(
    '@display' => 'page',
  )), 'No view page link found on the page.');

  // Save a path and make sure the summary appears as expected.
  $random_path = $this
    ->randomMachineName();

  // @todo Once https://www.drupal.org/node/2351379 is resolved, Views will no
  //   longer use Url::fromUri(), and this path will be able to contain ':'.
  $random_path = str_replace(':', '', $random_path);
  $this
    ->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array(
    'path' => $random_path,
  ), t('Apply'));
  $this
    ->assertText('/' . $random_path, 'The custom path appears in the summary.');
  $display_link_text = t('View @display', [
    '@display' => 'Page',
  ]);
  $this
    ->assertLink($display_link_text, 0, 'view page link found on the page.');
  $this
    ->clickLink($display_link_text);
  $this
    ->assertUrl($random_path);
}