function BlockExampleMenuTest::testBlockExampleLink

Same name in other branches
  1. 3.x modules/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\Functional

Code

public function testBlockExampleLink() {
    $this->drupalGet('');
    $this->assertSession()
        ->linkByHrefExists('examples/block-example');
    $this->drupalGet('examples/block-example');
    $this->assertSession()
        ->statusCodeEquals(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->assertSession()
        ->statusCodeEquals(403);
}