You are here

public function RouterTest::testRouterMatching in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Routing/RouterTest.php \Drupal\system\Tests\Routing\RouterTest::testRouterMatching()

Tests that a page trying to match a path will succeed.

File

core/modules/system/src/Tests/Routing/RouterTest.php, line 205
Contains \Drupal\system\Tests\Routing\RouterTest.

Class

RouterTest
Functional class for the full integrated routing system.

Namespace

Drupal\system\Tests\Routing

Code

public function testRouterMatching() {
  $this
    ->drupalGet('router_test/test14/1');
  $this
    ->assertResponse(200);
  $this
    ->assertText('User route "entity.user.canonical" was matched.');

  // Try to match a route for a non-existent user.
  $this
    ->drupalGet('router_test/test14/2');
  $this
    ->assertResponse(200);
  $this
    ->assertText('Route not matched.');

  // Check that very long paths don't cause an error.
  $path = 'router_test/test1';
  $suffix = '/d/r/u/p/a/l';
  for ($i = 0; $i < 10; $i++) {
    $path .= $suffix;
    $this
      ->drupalGet($path);
    $this
      ->assertResponse(404);
  }
}