function AccessResultNeutralTest::testSetReason

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

Tests setReason()

@covers ::setReason

File

core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php, line 34

Class

AccessResultNeutralTest
@coversDefaultClass \Drupal\Core\Access\AccessResultNeutral @group Access

Namespace

Drupal\Tests\Core\Access

Code

public function testSetReason() {
    $a = new AccessResultNeutral();
    $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.