diff --git a/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php b/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php index fa3eab0..30be5f8 100644 --- a/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php +++ b/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php @@ -5,17 +5,17 @@ /** * Interface for access result value objects with stored reason for developers. * - * For example, a developer can specify the reason of an access rejection : + * For example, a developer can specify the reason for forbidden access: * - * new AccessResultForbidden('You\'re not authorized to hack core'); + * new AccessResultForbidden('You are not authorized to hack core'); * * - * @see AccessResultForbidden + * @see \Drupal\Core\Access\AccessResultInterface */ interface AccessResultReasonInterface extends AccessResultInterface { /** - * Gets the reason of this access result. + * Gets the reason for this access result. * * @return string|NULL * The reason of this access result or NULL if no reason is provided. @@ -23,12 +23,12 @@ public function getReason(); /** - * Sets the reason of this access result. + * Sets the reason for this access result. * * @param $reason string|NULL * The reason of this access result or NULL if no reason is provided. * - * @return AccessResultInterface + * @return \Drupal\Core\Access\AccessResultInterface * The access result instance. */ public function setReason($reason); diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php index 3c079c8..7b5c982 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php @@ -1,10 +1,5 @@ setupRouter(); + $request = new Request(); + $reason = $this->getRandomGenerator()->string(); + $access_result = AccessResult::forbidden($reason); + $this->accessManager->expects($this->once()) + ->method('checkRequest') + ->with($request) + ->willReturn($access_result); + $this->setExpectedException(AccessDeniedHttpException::class, $reason); + $this->router->matchRequest($request); + } + + /** * Ensure that methods are passed to the wrapped router. * * @covers ::__call