public function AccessResultTest::testAccessConditionallyAllowed in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::testAccessConditionallyAllowed()
- 9 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::testAccessConditionallyAllowed()
@covers ::allowedIf @covers ::isAllowed @covers ::isForbidden @covers ::isNeutral
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php, line 145 - Contains \Drupal\Tests\Core\Access\AccessResultTest.
Class
- AccessResultTest
- @coversDefaultClass \Drupal\Core\Access\AccessResult @group Access
Namespace
Drupal\Tests\Core\AccessCode
public function testAccessConditionallyAllowed() {
$verify = function (AccessResult $access, $allowed) {
$this
->assertSame($allowed, $access
->isAllowed());
$this
->assertFalse($access
->isForbidden());
$this
->assertSame(!$allowed, $access
->isNeutral());
$this
->assertDefaultCacheability($access);
};
$b1 = AccessResult::allowedIf(TRUE);
$verify($b1, TRUE);
$b2 = AccessResult::allowedIf(FALSE);
$verify($b2, FALSE);
}