c0e6ba77aa6a3416e6d06b7c9c3ca2643de2a870
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Context / WorkspaceAspectTest.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\WorkspaceAspect;
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21
22 class WorkspaceAspectTest extends UnitTestCase
23 {
24 /**
25 * @test
26 */
27 public function getterReturnsProperDefaultValues()
28 {
29 $subject = new WorkspaceAspect();
30 $this->assertTrue($subject->isLive());
31 $this->assertEquals(0, $subject->getId());
32 $this->assertEquals(0, $subject->get('id'));
33 $this->assertTrue($subject->get('isLive'));
34 $this->assertFalse($subject->get('isOffline'));
35 }
36
37 /**
38 * @test
39 */
40 public function getterReturnsProperCustomValues()
41 {
42 $subject = new WorkspaceAspect(13);
43 $this->assertEquals(13, $subject->getId());
44 $this->assertEquals(13, $subject->get('id'));
45 $this->assertFalse($subject->isLive());
46 $this->assertFalse($subject->get('isLive'));
47 $this->assertTrue($subject->get('isOffline'));
48 }
49
50 /**
51 * @test
52 */
53 public function getThrowsExceptionOnInvalidArgument()
54 {
55 $this->expectException(AspectPropertyNotFoundException::class);
56 $subject = new WorkspaceAspect();
57 $subject->get('football');
58 }
59 }