class 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

modules/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
   */
  protected 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->assertSession()
        ->linkByHrefExists($path);
    }
    $this->drupalGet('/examples/testing-example');
    $this->assertSession()
      ->statusCodeEquals(200);
  }

}

Members

Title Sort descending Modifiers Object type Summary
TestingExampleMenuTest::$defaultTheme protected property
TestingExampleMenuTest::$modules protected 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.