‪TYPO3CMS  ‪main
ApplicationTypeTest.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
25 final class ‪ApplicationTypeTest extends UnitTestCase
26 {
30  public function ‪fromRequestThrowsIfTypeIsMissing(): void
31  {
32  $this->expectException(\RuntimeException::class);
33  $this->expectExceptionCode(1606222812);
35  }
36 
40  public function ‪isFrontendReturnsTrueIfFrontend(): void
41  {
42  self::assertTrue(
44  ->isFrontend()
45  );
46  }
47 
52  {
53  self::assertFalse(
55  ->isFrontend()
56  );
57  }
58 
62  public function ‪isBackendReturnsTrueIfBackend(): void
63  {
64  self::assertTrue(
66  ->isBackend()
67  );
68  }
69 
73  public function ‪isBackendReturnsTrueIfNotBackend(): void
74  {
75  self::assertFalse(
77  ->isBackend()
78  );
79  }
80 
84  public function ‪isFrontendEnumResolved(): void
85  {
86  $type = ApplicationType::FRONTEND;
87  self::assertSame('frontend', $type->value);
88  self::assertSame('FE', $type->abbreviate());
89  }
90 
94  public function ‪isBackendEnumResolved(): void
95  {
96  $type = ApplicationType::BACKEND;
97  self::assertSame('backend', $type->value);
98  self::assertSame('BE', $type->abbreviate());
99  }
100 }
‪TYPO3\CMS\Core\Tests\Unit\Http
Definition: ApplicationTypeTest.php:18
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder
Definition: SystemEnvironmentBuilder.php:41
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isBackendReturnsTrueIfNotBackend
‪isBackendReturnsTrueIfNotBackend()
Definition: ApplicationTypeTest.php:73
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_BE
‪const REQUESTTYPE_BE
Definition: SystemEnvironmentBuilder.php:45
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isFrontendReturnsFalseIfNotFrontend
‪isFrontendReturnsFalseIfNotFrontend()
Definition: ApplicationTypeTest.php:51
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isBackendEnumResolved
‪isBackendEnumResolved()
Definition: ApplicationTypeTest.php:94
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest
Definition: ApplicationTypeTest.php:26
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\fromRequestThrowsIfTypeIsMissing
‪fromRequestThrowsIfTypeIsMissing()
Definition: ApplicationTypeTest.php:30
‪TYPO3\CMS\Core\Http\ServerRequest
Definition: ServerRequest.php:39
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isFrontendEnumResolved
‪isFrontendEnumResolved()
Definition: ApplicationTypeTest.php:84
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isBackendReturnsTrueIfBackend
‪isBackendReturnsTrueIfBackend()
Definition: ApplicationTypeTest.php:62
‪TYPO3\CMS\Core\Tests\Unit\Http\ApplicationTypeTest\isFrontendReturnsTrueIfFrontend
‪isFrontendReturnsTrueIfFrontend()
Definition: ApplicationTypeTest.php:40
‪TYPO3\CMS\Core\Http\fromRequest
‪@ fromRequest
Definition: ApplicationType.php:67
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_FE
‪const REQUESTTYPE_FE
Definition: SystemEnvironmentBuilder.php:43
‪TYPO3\CMS\Core\Http\ApplicationType
‪ApplicationType
Definition: ApplicationType.php:56