You are here

protected function DisplayPathTest::doBasicPathUITest in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/DisplayPathTest.php \Drupal\Tests\views_ui\Functional\DisplayPathTest::doBasicPathUITest()
  2. 10 core/modules/views_ui/tests/src/Functional/DisplayPathTest.php \Drupal\Tests\views_ui\Functional\DisplayPathTest::doBasicPathUITest()

Tests basic functionality in configuring a view.

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

File

core/modules/views_ui/tests/src/Functional/DisplayPathTest.php, line 54

Class

DisplayPathTest
Tests the UI of generic display path plugin.

Namespace

Drupal\Tests\views_ui\Functional

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, [], 'Add Page');
  $this
    ->assertText(t('No path is set'), 'The right text appears if no path was set.');
  $this
    ->assertSession()
    ->linkNotExists(t('View @display', [
    '@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', [
    '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
    ->assertSession()
    ->linkExists($display_link_text, 0, 'view page link found on the page.');
  $this
    ->clickLink($display_link_text);
  $this
    ->assertUrl($random_path);
}