function AccessResultForbiddenTest::testSetReason

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php \Drupal\Tests\Core\Access\AccessResultForbiddenTest::testSetReason()
  2. 8.9.x core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php \Drupal\Tests\Core\Access\AccessResultForbiddenTest::testSetReason()
  3. 10 core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php \Drupal\Tests\Core\Access\AccessResultForbiddenTest::testSetReason()

Tests setReason()

@covers ::setReason

File

core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php, line 37

Class

AccessResultForbiddenTest
@coversDefaultClass \Drupal\Core\Access\AccessResultForbidden @group Access

Namespace

Drupal\Tests\Core\Access

Code

public function testSetReason() : void {
    $a = new AccessResultForbidden();
    $reason = $this->getRandomGenerator()
        ->string();
    $return = $a->setReason($reason);
    $this->assertSame($reason, $a->getReason());
    $this->assertSame($a, $return);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.