3 namespace Drupal\Tests\system\Functional\Routing;
5 use Drupal\Tests\BrowserTestBase;
8 * Function Tests for the routing permission system.
12 class RouterPermissionTest extends BrowserTestBase {
19 public static $modules = ['router_test'];
22 * Tests permission requirements on routes.
24 public function testPermissionAccess() {
25 $path = 'router_test/test7';
26 $this->drupalGet($path);
27 $this->assertResponse(403, "Access denied for a route where we don't have a permission");
29 $this->drupalGet('router_test/test8');
30 $this->assertResponse(403, 'Access denied by default if no access specified');
32 $user = $this->drupalCreateUser(['access test7']);
33 $this->drupalLogin($user);
34 $this->drupalGet('router_test/test7');
35 $this->assertResponse(200);
36 $this->assertNoRaw('Access denied');
37 $this->assertRaw('test7text', 'The correct string was returned because the route was successful.');