You are here

public function AccessResultNeutralTest::testSetReason in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php \Drupal\Tests\Core\Access\AccessResultNeutralTest::testSetReason()
  2. 9 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);
}