function AccessResultTest::testAccessConditionallyAllowed
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::testAccessConditionallyAllowed()
- 10 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::testAccessConditionallyAllowed()
- 11.x 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 144
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.