function AccessResultTest::testConstruction
Tests the construction of an AccessResult object.
@legacy-covers ::neutral
File
-
core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php, line 63
Class
Namespace
Drupal\Tests\Core\AccessCode
public function testConstruction() : void {
$verify = function (AccessResult $access) {
$this->assertFalse($access->isAllowed());
$this->assertFalse($access->isForbidden());
$this->assertTrue($access->isNeutral());
$this->assertDefaultCacheability($access);
};
// Verify the object when using the constructor.
$a = new AccessResultNeutral();
$verify($a);
// Verify the object when using the ::create() convenience method.
$b = AccessResult::neutral();
$verify($b);
$this->assertEquals($a, $b);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.