class TestingExampleMenuTest

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

Test the user-facing menus in Testing Example.

Note that this is not an example test. We use this test to verify that testing_example's links and routes all work.

@group testing_example @group examples

Hierarchy

Expanded class hierarchy of TestingExampleMenuTest

Related topics

File

testing_example/tests/src/Functional/TestingExampleMenuTest.php, line 18

Namespace

Drupal\Tests\testing_example\Functional
View source
class TestingExampleMenuTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    public static $modules = [
        'testing_example',
    ];
    
    /**
     * The installation profile to use with this test.
     *
     * We need the 'minimal' profile in order to make sure the Tool block is
     * available.
     *
     * @var string
     */
    protected $profile = 'minimal';
    
    /**
     * Verify and validate that default menu links were loaded for this module.
     */
    public function testTestingNavigation() {
        foreach ([
            '' => '/examples/testing-example',
        ] as $page => $path) {
            $this->drupalGet($page);
            $this->assertLinkByHref($path);
        }
        $this->drupalGet('/examples/testing-example');
        $this->assertResponse(200);
    }

}

Members

Title Sort descending Modifiers Object type Summary
TestingExampleMenuTest::$defaultTheme protected property
TestingExampleMenuTest::$modules public static property Modules to enable.
TestingExampleMenuTest::$profile protected property The installation profile to use with this test.
TestingExampleMenuTest::testTestingNavigation public function Verify and validate that default menu links were loaded for this module.