public function PageExampleTest::testPageExampleLinks in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/page_example/tests/src/Functional/PageExampleTest.php \Drupal\Tests\page_example\Functional\PageExampleTest::testPageExampleLinks()
Verify and validate that default menu links were loaded for this module.
@dataProvider providerMenuLinks
File
- page_example/
tests/ src/ Functional/ PageExampleTest.php, line 104
Class
- PageExampleTest
- Creates page and render the content based on the arguments passed in the URL.
Namespace
Drupal\Tests\page_example\FunctionalCode
public function testPageExampleLinks($permission, $links) {
if ($permission) {
$user = $this
->drupalCreateUser([
$permission,
]);
$this
->drupalLogin($user);
}
foreach ($links as $page => $path) {
$this
->drupalGet($page);
$this
->assertSession()
->linkByHrefExists($path);
}
if ($permission) {
$this
->drupalLogout();
}
}