‪TYPO3CMS  11.5
WorkspaceAspectTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
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 
19 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 class ‪WorkspaceAspectTest extends UnitTestCase
25 {
29  public function ‪getterReturnsProperDefaultValues(): void
30  {
31  $subject = new ‪WorkspaceAspect();
32  self::assertTrue($subject->isLive());
33  self::assertEquals(0, $subject->getId());
34  self::assertEquals(0, $subject->get('id'));
35  self::assertTrue($subject->get('isLive'));
36  self::assertFalse($subject->get('isOffline'));
37  }
38 
42  public function ‪getterReturnsProperCustomValues(): void
43  {
44  $subject = new ‪WorkspaceAspect(13);
45  self::assertEquals(13, $subject->getId());
46  self::assertEquals(13, $subject->get('id'));
47  self::assertFalse($subject->isLive());
48  self::assertFalse($subject->get('isLive'));
49  self::assertTrue($subject->get('isOffline'));
50  }
51 
56  {
57  $this->expectException(AspectPropertyNotFoundException::class);
58  $this->expectExceptionCode(1527779447);
59  $subject = new ‪WorkspaceAspect();
60  $subject->get('football');
61  }
62 }
‪TYPO3\CMS\Core\Context\WorkspaceAspect
Definition: WorkspaceAspect.php:31
‪TYPO3\CMS\Core\Tests\Unit\Context\WorkspaceAspectTest\getterReturnsProperCustomValues
‪getterReturnsProperCustomValues()
Definition: WorkspaceAspectTest.php:42
‪TYPO3\CMS\Core\Tests\Unit\Context\WorkspaceAspectTest
Definition: WorkspaceAspectTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Context\WorkspaceAspectTest\getterReturnsProperDefaultValues
‪getterReturnsProperDefaultValues()
Definition: WorkspaceAspectTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Context\WorkspaceAspectTest\getThrowsExceptionOnInvalidArgument
‪getThrowsExceptionOnInvalidArgument()
Definition: WorkspaceAspectTest.php:55
‪TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException
Definition: AspectPropertyNotFoundException.php:25
‪TYPO3\CMS\Core\Tests\Unit\Context
Definition: ContextTest.php:18