function PageExampleTest::testPageExampleLinks

Same name in other branches
  1. 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

modules/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\Functional

Code

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();
    }
}