You are here

public function AccessResultNeutralTest::testConstruction in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php \Drupal\Tests\Core\Access\AccessResultNeutralTest::testConstruction()
  2. 10 core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php \Drupal\Tests\Core\Access\AccessResultNeutralTest::testConstruction()

Tests the construction of an AccessResultForbidden object.

@covers ::__construct @covers ::getReason

File

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

Class

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

Namespace

Drupal\Tests\Core\Access

Code

public function testConstruction() {
  $a = new AccessResultNeutral();
  $this
    ->assertNull($a
    ->getReason());
  $reason = $this
    ->getRandomGenerator()
    ->string();
  $b = new AccessResultNeutral($reason);
  $this
    ->assertEquals($reason, $b
    ->getReason());
}