function AccessResultNeutralTest::testConstruction

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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->assertEquals('', $a->getReason());
    $reason = $this->getRandomGenerator()
        ->string();
    $b = new AccessResultNeutral($reason);
    $this->assertEquals($reason, $b->getReason());
}

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