You are here

protected function DisplayPathTest::doBasicPathUITest in Drupal 10

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

Tests basic functionality in configuring a view.

File

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

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
    ->submitForm([], 'Add Page');
  $this
    ->assertSession()
    ->pageTextContains('No path is set');
  $this
    ->assertSession()
    ->linkNotExists('View 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
    ->drupalGet('admin/structure/views/nojs/display/test_view/page_1/path');
  $this
    ->submitForm([
    'path' => $random_path,
  ], 'Apply');
  $this
    ->assertSession()
    ->pageTextContains('/' . $random_path);
  $this
    ->clickLink('View Page');
  $this
    ->assertSession()
    ->addressEquals($random_path);
}