function PHPUnitExampleMenuTest::testLinksAndPages
Same name in this branch
- 4.0.x modules/phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php \Drupal\Tests\phpunit_example\Functional\PHPUnitExampleMenuTest::testLinksAndPages()
Same name in other branches
- 3.x modules/phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php \Drupal\Tests\phpunit_example\Functional\PHPUnitExampleMenuTest::testLinksAndPages()
- 8.x-1.x phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php \Drupal\Tests\phpunit_example\Functional\PHPUnitExampleMenuTest::testLinksAndPages()
Verify and validate that default menu links were loaded for this module.
File
-
modules/
testing_example/ tests/ src/ Functional/ PHPUnitExampleMenuTest.php, line 46
Class
- PHPUnitExampleMenuTest
- Test the user-facing menus in PHPUnit Example.
Namespace
Drupal\Tests\testing_example\FunctionalCode
public function testLinksAndPages() {
$this->drupalLogin($this->createUser([
'access content',
]));
$assert = $this->assertSession();
$links = [
'' => Url::fromRoute('testing_example.phpunit_description'),
];
// Go to the page and see if the link appears on it.
foreach ($links as $page => $path) {
$this->drupalGet($page);
$assert->linkByHrefExists($path->getInternalPath());
}
// Visit all the links and make sure they return 200.
foreach ($links as $path) {
$this->drupalGet($path);
$assert->statusCodeEquals(200);
}
}