Upgraded drupal core with security updates
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Access / AccessResultForbiddenTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\Access;
4
5 use Drupal\Core\Access\AccessResultForbidden;
6 use Drupal\Tests\UnitTestCase;
7
8 /**
9  * @coversDefaultClass \Drupal\Core\Access\AccessResultForbidden
10  * @group Access
11  */
12 class AccessResultForbiddenTest extends UnitTestCase {
13
14   /**
15    * Tests the construction of an AccessResultForbidden object.
16    *
17    * @covers ::__construct
18    * @covers ::getReason
19    */
20   public function testConstruction() {
21
22     $a = new AccessResultForbidden();
23     $this->assertEquals(NULL, $a->getReason());
24
25     $reason = $this->getRandomGenerator()->string();
26     $b = new AccessResultForbidden($reason);
27     $this->assertEquals($reason, $b->getReason());
28   }
29
30   /**
31    * Test setReason()
32    *
33    * @covers ::setReason
34    */
35   public function testSetReason() {
36     $a = new AccessResultForbidden();
37
38     $reason = $this->getRandomGenerator()->string();
39     $return = $a->setReason($reason);
40
41     $this->assertSame($reason, $a->getReason());
42     $this->assertSame($a, $return);
43   }
44
45 }