
| Current Path : /var/www/html1/bbp/web/core/modules/system/tests/src/Functional/Routing/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/bbp/web/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php |
<?php
namespace Drupal\Tests\system\Functional\Routing;
use Drupal\Tests\BrowserTestBase;
/**
* Function Tests for the routing permission system.
*
* @group Routing
*/
class RouterPermissionTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['router_test'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests permission requirements on routes.
*/
public function testPermissionAccess() {
// Ensure 403 Access Denied for a route without permission.
$this->drupalGet('router_test/test7');
$this->assertSession()->statusCodeEquals(403);
// Ensure 403 Access Denied by default if no access specified.
$this->drupalGet('router_test/test8');
$this->assertSession()->statusCodeEquals(403);
$user = $this->drupalCreateUser(['access test7']);
$this->drupalLogin($user);
$this->drupalGet('router_test/test7');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoRaw('Access denied');
$this->assertRaw('test7text');
}
}