class BlockExampleMenuTest

Same name in other branches
  1. 3.x modules/block_example/tests/src/Functional/BlockExampleMenuTest.php \Drupal\Tests\block_example\Functional\BlockExampleMenuTest
  2. 4.0.x modules/block_example/tests/src/Functional/BlockExampleMenuTest.php \Drupal\Tests\block_example\Functional\BlockExampleMenuTest

Test the user-facing menus in Block Example.

@group block_example @group examples

Hierarchy

  • class \Drupal\Tests\block_example\Functional\BlockExampleMenuTest extends \Drupal\Tests\BrowserTestBase

Expanded class hierarchy of BlockExampleMenuTest

Related topics

File

block_example/tests/src/Functional/BlockExampleMenuTest.php, line 15

Namespace

Drupal\Tests\block_example\Functional
View source
class BlockExampleMenuTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    public static $modules = [
        'block',
        'block_example',
    ];
    
    /**
     * The installation profile to use with this test.
     *
     * This test class requires the "Tools" block.
     *
     * @var string
     */
    protected $profile = 'minimal';
    
    /**
     * Test for a link to the block example in the Tools menu.
     */
    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);
    }

}

Members

Title Sort descending Modifiers Object type Summary
BlockExampleMenuTest::$defaultTheme protected property
BlockExampleMenuTest::$modules public static property Modules to enable.
BlockExampleMenuTest::$profile protected property The installation profile to use with this test.
BlockExampleMenuTest::testBlockExampleLink public function Test for a link to the block example in the Tools menu.