function StreamWrapperExampleTest::testRoutes

Same name in other branches
  1. 4.0.x modules/stream_wrapper_example/tests/src/Functional/StreamWrapperExampleTest.php \Drupal\Tests\stream_wrapper_example\Functional\StreamWrapperExampleTest::testRoutes()

Make sure all the public routes behave the way they should.

File

modules/stream_wrapper_example/tests/src/Functional/StreamWrapperExampleTest.php, line 31

Class

StreamWrapperExampleTest
Functional tests for the stream wrapper example.

Namespace

Drupal\Tests\stream_wrapper_example\Functional

Code

public function testRoutes() {
    $assert = $this->assertSession();
    $this->drupalLogin($this->createUser([
        'access content',
    ]));
    $links = [
        '' => Url::fromRoute('stream_wrapper_example.description'),
    ];
    // Check for the toolbar links.
    foreach ($links as $page => $path) {
        $this->drupalGet($page);
        $assert->linkByHrefExists($path->getInternalPath());
    }
    // Visit each route.
    foreach ($links as $path) {
        $this->drupalGet($path);
        $assert->statusCodeEquals(200);
    }
}