‪TYPO3CMS  ‪main
ResolverTest.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 
20 use PHPUnit\Framework\Attributes\Test;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 final class ‪ResolverTest extends FunctionalTestCase
26 {
27  #[Test]
29  {
30  // @todo: This will raise a deprecation log level entry later, when TSFE->id is
31  // actively deprecated. See hint in Typo3ConditionFunctionsProvider.
32  $frontendControllerMock = $this
33  ->getMockBuilder(TypoScriptFrontendController::class)
34  ->disableOriginalConstructor()
35  ->getMock();
36  $frontendControllerMock->id = 123;
37 
38  $resolver = new ‪Resolver('typoscript', ['tsfe' => $frontendControllerMock]);
39  self::assertFalse($resolver->evaluate('getTSFE() && getTSFE().id == 321'));
40  self::assertTrue($resolver->evaluate('getTSFE() && getTSFE().id == 123'));
41  self::assertFalse($resolver->evaluate('getTSFE()?.id == 321'));
42  self::assertTrue($resolver->evaluate('getTSFE()?.id == 123'));
43  }
44 
45  #[Test]
47  {
48  $resolver = new ‪Resolver('typoscript', []);
49  self::assertFalse($resolver->evaluate('getTSFE() && getTSFE().id == 123'));
50  self::assertFalse($resolver->evaluate('getTSFE()?.id == 123'));
51  }
52 }
‪TYPO3\CMS\Core\Tests\Functional\ExpressionLanguage\ResolverTest\evaluateWithTyposcriptWithoutTsfeEvaluatesCorrectly
‪evaluateWithTyposcriptWithoutTsfeEvaluatesCorrectly()
Definition: ResolverTest.php:46
‪TYPO3\CMS\Core\Tests\Functional\ExpressionLanguage\ResolverTest\evaluateWithTyposcriptAndTsfeEvaluatesCorrectly
‪evaluateWithTyposcriptAndTsfeEvaluatesCorrectly()
Definition: ResolverTest.php:28
‪TYPO3\CMS\Core\Tests\Functional\ExpressionLanguage
Definition: ResolverTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\ExpressionLanguage\ResolverTest
Definition: ResolverTest.php:26
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:58
‪TYPO3\CMS\Core\ExpressionLanguage\Resolver
Definition: Resolver.php:32