[BUGFIX] Adapt glitches of context patch
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Context / VisibilityAspectTest.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core\Tests\Unit\Context;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException;
19 use TYPO3\CMS\Core\Context\VisibilityAspect;
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21
22 class VisibilityAspectTest extends UnitTestCase
23 {
24 /**
25 * @test
26 */
27 public function getterReturnsProperDefaultValues()
28 {
29 $subject = new VisibilityAspect();
30 $this->assertFalse($subject->includeHiddenPages());
31 $this->assertFalse($subject->includeHiddenContent());
32 $this->assertFalse($subject->includeDeletedRecords());
33 }
34
35 /**
36 * @test
37 */
38 public function getterReturnsProperValues()
39 {
40 $subject = new VisibilityAspect(true, true, true);
41 $this->assertTrue($subject->includeHiddenPages());
42 $this->assertTrue($subject->includeHiddenContent());
43 $this->assertTrue($subject->includeDeletedRecords());
44 }
45
46 /**
47 * @test
48 */
49 public function getReturnsProperValues()
50 {
51 $subject = new VisibilityAspect(true, true, true);
52 $this->assertTrue($subject->get('includeHiddenPages'));
53 $this->assertTrue($subject->get('includeHiddenContent'));
54 $this->assertTrue($subject->get('includeDeletedRecords'));
55 }
56
57 /**
58 * @test
59 */
60 public function getThrowsExceptionOnInvalidArgument()
61 {
62 $this->expectException(AspectPropertyNotFoundException::class);
63 $this->expectExceptionCode(1527780439);
64 $subject = new VisibilityAspect();
65 $subject->get('football');
66 }
67 }