function CacheExampleTest::testCacheExampleMenu

Same name in other branches
  1. 8.x-1.x cache_example/tests/src/Functional/CacheExampleTest.php \Drupal\Tests\cache_example\Functional\CacheExampleTest::testCacheExampleMenu()
  2. 4.0.x modules/cache_example/tests/src/Functional/CacheExampleTest.php \Drupal\Tests\cache_example\Functional\CacheExampleTest::testCacheExampleMenu()

Test menu links and routes.

Test the following:

  • A link to the cache_example in the Tools menu.
  • That you can successfully access the cache_example form.

File

modules/cache_example/tests/src/Functional/CacheExampleTest.php, line 43

Class

CacheExampleTest
Tests for the cache_example module.

Namespace

Drupal\Tests\cache_example\Functional

Code

public function testCacheExampleMenu() {
    $assert = $this->assertSession();
    // Test for a link to the cache_example in the Tools menu.
    $this->drupalGet('');
    $assert->statusCodeEquals(200);
    $assert->linkByHrefExists('examples/cache-example');
    // Verify if the can successfully access the cache_example form.
    $this->drupalGet('examples/cache-example');
    $assert->statusCodeEquals(200);
}