public function DisplayPageWebTest::assertPagePath in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php \Drupal\Tests\views\Functional\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
bool Assertion result.
1 call to DisplayPageWebTest::assertPagePath()
- DisplayPageWebTest::testPagePaths in core/
modules/ views/ tests/ src/ Functional/ Plugin/ DisplayPageWebTest.php - Tests the views page path functionality.
File
- core/
modules/ views/ tests/ src/ Functional/ Plugin/ DisplayPageWebTest.php, line 164
Class
- DisplayPageWebTest
- Tests the views page display plugin as webtest.
Namespace
Drupal\Tests\views\Functional\PluginCode
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
->assertSession()
->statusCodeEquals(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
->assertSession()
->statusCodeEquals(200);
}