public function BlockExampleMenuTest::testBlockExampleLink in Examples for Developers 3.x
Same name and namespace in other branches
- 8 block_example/tests/src/Functional/BlockExampleMenuTest.php \Drupal\Tests\block_example\Functional\BlockExampleMenuTest::testBlockExampleLink()
Test for a link to the block example in the Tools menu.
File
- modules/
block_example/ tests/ src/ Functional/ BlockExampleMenuTest.php, line 41
Class
- BlockExampleMenuTest
- Test the user-facing menus in Block Example.
Namespace
Drupal\Tests\block_example\FunctionalCode
public function testBlockExampleLink() {
$this
->drupalGet('');
$this
->assertLinkByHref('examples/block-example');
$this
->drupalGet('examples/block-example');
$this
->assertResponse(200);
// Verify that the block admin page link works.
$this
->clickLink('the block admin page');
// Since it links to the admin page, we should get a permissions error and
// not 404.
$this
->assertResponse(403);
}