function CalculatedPermissionsItemTest::testHasPermission
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php \Drupal\Tests\Core\Session\CalculatedPermissionsItemTest::testHasPermission()
Tests the permission check when the admin flag is not set.
@covers ::hasPermission @depends testConstructor
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ CalculatedPermissionsItemTest.php, line 47
Class
- CalculatedPermissionsItemTest
- Tests the CalculatedPermissionsItem value object.
Namespace
Drupal\Tests\Core\SessionCode
public function testHasPermission() : void {
$item = new CalculatedPermissionsItem([
'bar',
], FALSE, 'some_scope', 'foo');
$this->assertFalse($item->hasPermission('baz'), 'Missing permission was not found.');
$this->assertTrue($item->hasPermission('bar'), 'Existing permission was found.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.