You are here

public function AccessResultNeutralTest::testSetReason in Drupal 8

Same name and namespace in other branches
  1. 9 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()

Test 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);
}