You are here

public function DisplayPageWebTest::assertPagePath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php \Drupal\views\Tests\Plugin\DisplayPageWebTest::assertPagePath()

Tests that we can successfully change a view page display path.

Parameters

string $path: Path that will be set as the view page display path.

Return value

boolean Assertion result.

1 call to DisplayPageWebTest::assertPagePath()
DisplayPageWebTest::testPagePaths in core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php
Tests the views page path functionality.

File

core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php, line 163
Contains \Drupal\views\Tests\Plugin\DisplayPageWebTest.

Class

DisplayPageWebTest
Tests the views page display plugin as webtest.

Namespace

Drupal\views\Tests\Plugin

Code

public function assertPagePath($path) {
  $view = Views::getView('test_page_display_path');
  $view
    ->initDisplay('page_1');
  $view->displayHandlers
    ->get('page_1')
    ->overrideOption('path', $path);
  $view
    ->save();
  $this->container
    ->get('router.builder')
    ->rebuild();

  // Check if we successfully changed the path.
  $this
    ->drupalGet($path);
  $success = $this
    ->assertResponse(200);

  // Check if we don't get any error on the view edit page.
  $this
    ->drupalGet('admin/structure/views/view/test_page_display_path');
  return $success && $this
    ->assertResponse(200);
}