function FrontPageLinkDependenciesTest::testAddContentMenuItem
Same name in other branches
- 4.0.x modules/testing_example/tests/src/Functional/FrontPageLinkDependenciesTest.php \Drupal\Tests\testing_example\Functional\FrontPageLinkDependenciesTest::testAddContentMenuItem()
Tests for the existence of a default menu item on the home page.
We'll open the home page and look for the Tools menu link called 'Add content.'
File
-
modules/
testing_example/ tests/ src/ Functional/ FrontPageLinkDependenciesTest.php, line 60
Class
- FrontPageLinkDependenciesTest
- Tests core menu behavior.
Namespace
Drupal\Tests\testing_example\FunctionalCode
public function testAddContentMenuItem() {
// Step 1: Log in a user who can add content.
$this->drupalLogin($this->createUser([
'create ' . $this->contentType
->id() . ' content',
]));
// Step 2: Visit the home path.
$this->drupalGet($this->buildUrl(''));
// Step 3: Look on the page for the 'Add content' link.
$this->assertSession()
->linkExists('Add content');
}