public function AccessResultForbiddenTest::testConstruction in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php \Drupal\Tests\Core\Access\AccessResultForbiddenTest::testConstruction()
- 9 core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php \Drupal\Tests\Core\Access\AccessResultForbiddenTest::testConstruction()
Tests the construction of an AccessResultForbidden object.
@covers ::__construct @covers ::getReason
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultForbiddenTest.php, line 20
Class
- AccessResultForbiddenTest
- @coversDefaultClass \Drupal\Core\Access\AccessResultForbidden @group Access
Namespace
Drupal\Tests\Core\AccessCode
public function testConstruction() {
$a = new AccessResultForbidden();
$this
->assertEquals(NULL, $a
->getReason());
$reason = $this
->getRandomGenerator()
->string();
$b = new AccessResultForbidden($reason);
$this
->assertEquals($reason, $b
->getReason());
}