‪TYPO3CMS  9.5
AbstractConditionMatcherTest.php
Go to the documentation of this file.
1 <?php
2 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 
18 use Prophecy\Argument;
29 use TYPO3\CMS\Core\Package\PackageManager;
31 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
32 
36 class ‪AbstractConditionMatcherTest extends UnitTestCase
37 {
42 
46  protected ‪$conditionMatcher;
47 
52 
57 
61  protected function ‪setUp(): void
62  {
63  require_once 'Fixtures/ConditionMatcherUserFuncs.php';
64 
65  $this->resetSingletonInstances = true;
66  ‪$GLOBALS['TYPO3_REQUEST'] = new ‪ServerRequest();
67  $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
68  $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
69  $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
70  $cacheManagerProphecy = $this->prophesize(CacheManager::class);
71  $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
72  GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
73 
74  $packageManagerProphecy = $this->prophesize(PackageManager::class);
75  $corePackageProphecy = $this->prophesize(PackageInterface::class);
76  $corePackageProphecy->getPackagePath()->willReturn(__DIR__ . '/../../../../../../../sysext/core/');
77  $packageManagerProphecy->getActivePackages()->willReturn([
78  $corePackageProphecy->reveal()
79  ]);
80  GeneralUtility::setSingletonInstance(PackageManager::class, $packageManagerProphecy->reveal());
81 
83  $this->backupApplicationContext = GeneralUtility::getApplicationContext();
84  }
85 
86  protected function ‪initConditionMatcher()
87  {
88  // test the abstract methods via the backend condition matcher
89  $this->conditionMatcher = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline']);
90  $this->evaluateConditionCommonMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateConditionCommon');
91  $this->evaluateConditionCommonMethod->setAccessible(true);
92  $this->evaluateExpressionMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateExpression');
93  $this->evaluateExpressionMethod->setAccessible(true);
94  $loggerProphecy = $this->prophesize(Logger::class);
95  $this->conditionMatcher->setLogger($loggerProphecy->reveal());
96  }
97 
101  protected function ‪tearDown(): void
102  {
103  ‪Fixtures\GeneralUtilityFixture::setApplicationContext($this->backupApplicationContext);
104  parent::tearDown();
105  }
106 
110  public function ‪datesConditionDataProvider(): array
111  {
112  return [
113  '[dayofmonth = 17]' => ['dayofmonth', 17, true],
114  '[dayofweek = 3]' => ['dayofweek', 3, true],
115  '[dayofyear = 16]' => ['dayofyear', 16, true],
116  '[hour = 11]' => ['hour', 11, true],
117  '[minute = 4]' => ['minute', 4, true],
118  '[month = 1]' => ['month', 1, true],
119  '[year = 1945]' => ['year', 1945, true],
120  ];
121  }
122 
130  public function ‪checkConditionMatcherForDates(string $expressionMethod, int $expressionValue, bool $expected): void
131  {
132  ‪$GLOBALS['SIM_EXEC_TIME'] = mktime(11, 4, 0, 1, 17, 1945);
133  $this->assertSame($expected, $this->evaluateConditionCommonMethod->invokeArgs(
134  $this->conditionMatcher,
135  [$expressionMethod, $expressionValue]
136  ));
137  }
138 
142  public function ‪datesFunctionDataProvider(): array
143  {
144  return [
145  '[dayofmonth = 17]' => ['j', 17, true],
146  '[dayofweek = 3]' => ['w', 3, true],
147  '[dayofyear = 16]' => ['z', 16, true],
148  '[hour = 11]' => ['G', 11, true],
149  '[minute = 4]' => ['i', 4, true],
150  '[month = 1]' => ['n', 1, true],
151  '[year = 1945]' => ['Y', 1945, true],
152  ];
153  }
154 
162  public function ‪checkConditionMatcherForDateFunction(string $format, int $expressionValue, bool $expected): void
163  {
164  ‪$GLOBALS['SIM_EXEC_TIME'] = gmmktime(11, 4, 0, 1, 17, 1945);
165  GeneralUtility::makeInstance(Context::class)
166  ->setAspect('date', new ‪DateTimeAspect(new \DateTimeImmutable('@' . ‪$GLOBALS['SIM_EXEC_TIME'])));
167  $this->assertSame(
168  $expected,
169  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['date("' . $format . '") == ' . $expressionValue])
170  );
171  }
172 
176  public function ‪checkConditionMatcherForFeatureFunction(): void
177  {
178  $featureName = 'test.testFeature';
179  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName] = true;
180  $this->assertTrue(
181  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '")'])
182  );
183  $this->assertTrue(
184  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == true'])
185  );
186  $this->assertTrue(
187  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === true'])
188  );
189  $this->assertFalse(
190  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == false'])
191  );
192  $this->assertFalse(
193  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === false'])
194  );
195 
196  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName] = false;
197  $this->assertFalse(
198  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '")'])
199  );
200  $this->assertFalse(
201  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == true'])
202  );
203  $this->assertFalse(
204  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === true'])
205  );
206  $this->assertTrue(
207  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == false'])
208  );
209  $this->assertTrue(
210  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === false'])
211  );
212  }
213 
217  public function ‪hostnameDataProvider(): array
218  {
219  return [
220  '[hostname = localhost]' => ['hostname', 'localhost', true],
221  '[hostname = localhost, foo.local]' => ['hostname', 'localhost, foo.local', true],
222  '[hostname = bar.local, foo.local]' => ['hostname', 'bar.local, foo.local', false],
223  ];
224  }
225 
233  public function ‪checkConditionMatcherForHostname(string $expressionMethod, string $expressionValue, bool $expected): void
234  {
235  ‪$GLOBALS['_SERVER']['REMOTE_ADDR'] = '127.0.0.1';
236  $this->assertSame($expected, $this->evaluateConditionCommonMethod->invokeArgs(
237  $this->conditionMatcher,
238  [$expressionMethod, $expressionValue]
239  ));
240  }
241 
248  {
249  return [
250  ['Production*'],
251  ['Production/Staging/*'],
252  ['Production/Staging/Server2'],
253  ['/^Production.*$/'],
254  ['/^Production\\/.+\\/Server\\d+$/'],
255  ];
256  }
257 
262  public function ‪evaluateConditionCommonReturnsTrueForMatchingContexts($matchingContextCondition): void
263  {
265  $applicationContext = new ApplicationContext('Production/Staging/Server2');
267  $this->‪initConditionMatcher();
268 
269  $this->assertTrue(
270  $this->evaluateConditionCommonMethod->invokeArgs($this->conditionMatcher, ['applicationContext', $matchingContextCondition])
271  );
272  // Test expression language
273  $this->assertTrue(
274  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like(applicationContext, "' . preg_quote($matchingContextCondition, '/') . '")'])
275  );
276  }
277 
284  {
285  return [
286  ['Production'],
287  ['Testing*'],
288  ['Development/Profiling, Testing/Unit'],
289  ['Testing/Staging/Server2'],
290  ['/^Testing.*$/'],
291  ['/^Production\\/.+\\/Host\\d+$/'],
292  ];
293  }
294 
299  public function ‪evaluateConditionCommonReturnsNullForNotMatchingApplicationContexts($notMatchingApplicationContextCondition): void
300  {
302  $applicationContext = new ApplicationContext('Production/Staging/Server2');
304  $this->‪initConditionMatcher();
305 
306  $this->assertFalse(
307  $this->evaluateConditionCommonMethod->invokeArgs($this->conditionMatcher, ['applicationContext', $notMatchingApplicationContextCondition])
308  );
309  // Test expression language
310  $this->assertFalse(
311  $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like(applicationContext, "' . preg_quote($notMatchingApplicationContextCondition, '/') . '")'])
312  );
313  }
314 
320  public function ‪evaluateConditionCommonDevIpMaskDataProvider(): array
321  {
322  return [
323  // [0] $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']
324  // [1] Actual IP
325  // [2] Expected condition result
326  'IP matches' => [
327  '127.0.0.1',
328  '127.0.0.1',
329  true,
330  ],
331  'ipv4 wildcard subnet' => [
332  '127.0.0.1/24',
333  '127.0.0.2',
334  true,
335  ],
336  'ipv6 wildcard subnet' => [
337  '0:0::1/128',
338  '::1',
339  true,
340  ],
341  'List of addresses matches' => [
342  '1.2.3.4, 5.6.7.8',
343  '5.6.7.8',
344  true,
345  ],
346  'IP does not match' => [
347  '127.0.0.1',
348  '127.0.0.2',
349  false,
350  ],
351  'ipv4 subnet does not match' => [
352  '127.0.0.1/8',
353  '126.0.0.1',
354  false,
355  ],
356  'ipv6 subnet does not match' => [
357  '::1/127',
358  '::2',
359  false
360  ],
361  'List of addresses does not match' => [
362  '127.0.0.1, ::1',
363  '::2',
364  false,
365  ],
366  ];
367  }
368 
373  public function ‪evaluateConditionCommonEvaluatesIpAddressesCorrectly($devIpMask, $actualIp, $expectedResult): void
374  {
375  // Do not trigger proxy stuff of GeneralUtility::getIndPEnv
376  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP']);
377 
378  GeneralUtility::setIndpEnv('REMOTE_ADDR', $actualIp);
379  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = $devIpMask;
380  $this->‪initConditionMatcher();
381  $result = $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['ip("devIP")']);
382  $this->assertSame($expectedResult, $result);
383  }
384 
388  public function ‪testUserFuncIsCalled(): void
389  {
390  $this->assertTrue(
391  $this->evaluateConditionCommonMethod->invokeArgs(
392  $this->conditionMatcher,
393  ['userFunc', 'user_testFunction']
394  )
395  );
396  }
397 
401  public function ‪testUserFuncWithSingleArgument(): void
402  {
403  $this->assertTrue(
404  $this->evaluateConditionCommonMethod->invokeArgs(
405  $this->conditionMatcher,
406  ['userFunc', 'user_testFunctionWithSingleArgument(x)']
407  )
408  );
409  }
410 
414  public function ‪testUserFuncWithIntegerZeroArgument(): void
415  {
416  $this->assertTrue(
417  $this->evaluateConditionCommonMethod->invokeArgs(
418  $this->conditionMatcher,
419  ['userFunc', 'user_testFunctionWithSingleArgument(0)']
420  )
421  );
422  }
423 
427  public function ‪testUserFuncWithWhitespaceArgument(): void
428  {
429  $this->assertTrue(
430  $this->evaluateConditionCommonMethod->invokeArgs(
431  $this->conditionMatcher,
432  ['userFunc', 'user_testFunctionWithNoArgument( )']
433  )
434  );
435  }
436 
440  public function ‪testUserFuncWithMultipleArguments(): void
441  {
442  $this->assertTrue(
443  $this->evaluateConditionCommonMethod->invokeArgs(
444  $this->conditionMatcher,
445  ['userFunc', 'user_testFunctionWithThreeArguments(1,2,3)']
446  )
447  );
448  }
449 
454  {
455  $this->assertTrue(
456  $this->evaluateConditionCommonMethod->invokeArgs(
457  $this->conditionMatcher,
458  ['userFunc', 'user_testFunctionWithThreeArguments(0,true,"foo")']
459  )
460  );
461  }
462 
467  {
468  $this->assertTrue(
469  $this->evaluateConditionCommonMethod->invokeArgs(
470  $this->conditionMatcher,
471  ['userFunc', 'user_testFunctionWithThreeArguments(0,"foo",true)']
472  )
473  );
474  }
475 
480  {
481  $this->assertTrue(
482  $this->evaluateConditionCommonMethod->invokeArgs(
483  $this->conditionMatcher,
484  ['userFunc', 'user_testFunctionWithThreeArguments("foo",true,0)']
485  )
486  );
487  }
488 
493  {
494  $this->assertTrue(
495  $this->evaluateConditionCommonMethod->invokeArgs(
496  $this->conditionMatcher,
497  ['userFunc', 'user_testFunctionWithThreeArguments("foo",0,true)']
498  )
499  );
500  }
501 
506  {
507  $this->assertTrue(
508  $this->evaluateConditionCommonMethod->invokeArgs(
509  $this->conditionMatcher,
510  ['userFunc', 'user_testFunctionWithThreeArguments(true,0,"foo")']
511  )
512  );
513  }
514 
519  {
520  $this->assertTrue(
521  $this->evaluateConditionCommonMethod->invokeArgs(
522  $this->conditionMatcher,
523  ['userFunc', 'user_testFunctionWithThreeArguments(true,"foo",0)']
524  )
525  );
526  }
527 
532  {
533  $this->assertTrue(
534  $this->evaluateConditionCommonMethod->invokeArgs(
535  $this->conditionMatcher,
536  ['userFunc', "user_testFunctionWithThreeArguments(0,true,'foo')"]
537  )
538  );
539  }
540 
545  {
546  $this->assertTrue(
547  $this->evaluateConditionCommonMethod->invokeArgs(
548  $this->conditionMatcher,
549  ['userFunc', "user_testFunctionWithThreeArguments(0,'foo',true)"]
550  )
551  );
552  }
553 
558  {
559  $this->assertTrue(
560  $this->evaluateConditionCommonMethod->invokeArgs(
561  $this->conditionMatcher,
562  ['userFunc', "user_testFunctionWithThreeArguments('foo',true,0)"]
563  )
564  );
565  }
566 
571  {
572  $this->assertTrue(
573  $this->evaluateConditionCommonMethod->invokeArgs(
574  $this->conditionMatcher,
575  ['userFunc', "user_testFunctionWithThreeArguments('foo',0,true)"]
576  )
577  );
578  }
579 
584  {
585  $this->assertTrue(
586  $this->evaluateConditionCommonMethod->invokeArgs(
587  $this->conditionMatcher,
588  ['userFunc', "user_testFunctionWithThreeArguments(true,0,'foo')"]
589  )
590  );
591  }
592 
597  {
598  $this->assertTrue(
599  $this->evaluateConditionCommonMethod->invokeArgs(
600  $this->conditionMatcher,
601  ['userFunc', "user_testFunctionWithThreeArguments(true,'foo',0)"]
602  )
603  );
604  }
605 
610  {
611  $this->assertTrue(
612  $this->evaluateConditionCommonMethod->invokeArgs(
613  $this->conditionMatcher,
614  ['userFunc', "user_testFunctionWithThreeArguments('foo','bar', 'baz')"]
615  )
616  );
617  }
618 
623  {
624  $this->assertTrue(
625  $this->evaluateConditionCommonMethod->invokeArgs(
626  $this->conditionMatcher,
627  ['userFunc', 'user_testFunctionWithThreeArguments("foo","bar","baz")']
628  )
629  );
630  }
631 
635  public function ‪testUserFuncReturnsFalse(): void
636  {
637  $this->assertFalse(
638  $this->evaluateConditionCommonMethod->invokeArgs(
639  $this->conditionMatcher,
640  ['userFunc', 'user_testFunctionFalse']
641  )
642  );
643  }
644 
648  public function ‪testUserFuncWithMultipleArgumentsAndQuotes(): void
649  {
650  $this->assertTrue(
651  $this->evaluateConditionCommonMethod->invokeArgs(
652  $this->conditionMatcher,
653  ['userFunc', 'user_testFunctionWithThreeArguments(1,2,"3,4,5,6")']
654  )
655  );
656  }
657 
662  {
663  $this->assertTrue(
664  $this->evaluateConditionCommonMethod->invokeArgs(
665  $this->conditionMatcher,
666  ['userFunc', 'user_testFunctionWithThreeArguments ( 1 , 2, "3, 4, 5, 6" )']
667  )
668  );
669  }
670 
675  {
676  $this->assertTrue(
677  $this->evaluateConditionCommonMethod->invokeArgs(
678  $this->conditionMatcher,
679  ['userFunc', 'user_testFunctionWithThreeArgumentsSpaces ( 1 , 2, "3, 4, 5, 6" )']
680  )
681  );
682  }
683 
687  public function ‪testUserFuncWithSpacesInQuotes(): void
688  {
689  $this->assertTrue(
690  $this->evaluateConditionCommonMethod->invokeArgs(
691  $this->conditionMatcher,
692  ['userFunc', 'user_testFunctionWithSpaces(" 3, 4, 5, 6 ")']
693  )
694  );
695  }
696 
701  {
702  $this->assertTrue(
703  $this->evaluateConditionCommonMethod->invokeArgs(
704  $this->conditionMatcher,
705  ['userFunc', 'user_testFunctionWithThreeArgumentsSpaces ( 1 , 2, "3, \"4, 5\", 6" )']
706  )
707  );
708  }
709 
713  public function ‪testUserFuncWithQuoteMissing(): void
714  {
715  $this->assertTrue(
716  $this->evaluateConditionCommonMethod->invokeArgs(
717  $this->conditionMatcher,
718  ['userFunc', 'user_testFunctionWithQuoteMissing ("value \")']
719  )
720  );
721  }
722 
726  public function ‪testUserFuncWithQuotesInside(): void
727  {
728  $this->assertTrue(
729  $this->evaluateConditionCommonMethod->invokeArgs(
730  $this->conditionMatcher,
731  ['userFunc', 'user_testQuotes("1 \" 2")']
732  )
733  );
734  }
735 
739  public function ‪testUserFuncWithClassMethodCall(): void
740  {
741  $this->assertTrue(
742  $this->evaluateConditionCommonMethod->invokeArgs(
743  $this->conditionMatcher,
744  ['userFunc', 'ConditionMatcherUserFunctions::isTrue(1)']
745  )
746  );
747  }
748 
749  public function ‪expressionDataProvider(): array
750  {
751  return [
752  // Default variants
753  '[]' => ['[]', '[]'],
754  '[foo]' => ['[foo]', '[foo]'],
755  '[foo] && [bar]' => ['[foo] && [bar]', '[foo]&&[bar]'],
756  '[foo] AND [bar]' => ['[foo] AND [bar]', '[foo]&&[bar]'],
757  '[foo] and [bar]' => ['[foo] and [bar]', '[foo]&&[bar]'],
758  '[foo] [bar]' => ['[foo] [bar]', '[foo]||[bar]'],
759  '[foo] || [bar]' => ['[foo] || [bar]', '[foo]||[bar]'],
760  '[foo] OR [bar]' => ['[foo] OR [bar]', '[foo]||[bar]'],
761  '[foo] or [bar]' => ['[foo] or [bar]', '[foo]||[bar]'],
762  '[foo] && [bar]&&[baz]' => ['[foo] && [bar]&&[baz]', '[foo]&&[bar]&&[baz]'],
763  '[foo] AND [bar]AND[baz]' => ['[foo] AND [bar]AND[baz]', '[foo]&&[bar]&&[baz]'],
764  '[foo] and [bar]and[baz]' => ['[foo] and [bar]and[baz]', '[foo]&&[bar]&&[baz]'],
765  '[foo] || [bar]||[baz]' => ['[foo] || [bar]||[baz]', '[foo]||[bar]||[baz]'],
766  '[foo] OR [bar]OR[baz]' => ['[foo] OR [bar]OR[baz]', '[foo]||[bar]||[baz]'],
767  '[foo] or [bar]or[baz]' => ['[foo] or [bar]or[baz]', '[foo]||[bar]||[baz]'],
768  '[foo] && [bar]||[baz]' => ['[foo] && [bar]||[baz]', '[foo]&&[bar]||[baz]'],
769  '[foo] AND [bar]OR[baz]' => ['[foo] AND [bar]OR[baz]', '[foo]&&[bar]||[baz]'],
770  '[foo] and [bar]or[baz]' => ['[foo] and [bar]or[baz]', '[foo]&&[bar]||[baz]'],
771  '[foo] || [bar]OR[baz]' => ['[foo] || [bar]OR[baz]', '[foo]||[bar]||[baz]'],
772  '[foo] || [bar]or[baz]' => ['[foo] || [bar]or[baz]', '[foo]||[bar]||[baz]'],
773  '[foo] OR [bar]AND[baz]' => ['[foo] OR [bar]AND[baz]', '[foo]||[bar]&&[baz]'],
774  '[foo] or [bar]and[baz]' => ['[foo] or [bar]and[baz]', '[foo]||[bar]&&[baz]'],
775 
776  // Special variants
777  '[foo && bar && baz]' => ['[foo && bar && baz]', '[foo && bar && baz]'],
778  '[foo and bar and baz]' => ['[foo and bar and baz]', '[foo and bar and baz]'],
779  '[foo AND bar AND baz]' => ['[foo AND bar AND baz]', '[foo AND bar AND baz]'],
780  '[foo || bar || baz]' => ['[foo || bar || baz]', '[foo || bar || baz]'],
781  '[foo or bar or baz]' => ['[foo or bar or baz]', '[foo or bar or baz]'],
782  '[foo OR bar OR baz]' => ['[foo OR bar OR baz]', '[foo OR bar OR baz]'],
783  '[request.getParsedBody()[\'type\'] > 0]' => ['[request.getParsedBody()[\'type\'] > 0]', '[request.getParsedBody()[\'type\'] > 0]'],
784  '[request.getParsedBody()[\'type\'] > 0 || request.getQueryParams()[\'type\'] > 0]' => ['[request.getParsedBody()[\'type\'] > 0 || request.getQueryParams()[\'type\'] > 0]', '[request.getParsedBody()[\'type\'] > 0 || request.getQueryParams()[\'type\'] > 0]'],
785  '[request.getParsedBody()[\'type\'] > 0 or request.getQueryParams()[\'type\'] == 1]' => ['[request.getParsedBody()[\'type\'] > 0 or request.getQueryParams()[\'type\'] == 1]', '[request.getParsedBody()[\'type\'] > 0 or request.getQueryParams()[\'type\'] == 1]'],
786  '[ (request.getParsedBody()[\'type\'] > 0) || (request.getQueryParams()[\'type\'] > 0) ]' => ['[ (request.getParsedBody()[\'type\'] > 0) || (request.getQueryParams()[\'type\'] > 0) ]', '[ (request.getParsedBody()[\'type\'] > 0) || (request.getQueryParams()[\'type\'] > 0) ]'],
787  '[request.getParsedBody()[\'tx_news_pi1\'][\'news\'] > 0 || request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]' => ['[request.getParsedBody()[\'tx_news_pi1\'][\'news\'] > 0 || request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]', '[request.getParsedBody()[\'tx_news_pi1\'][\'news\'] > 0 || request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]'],
788  '[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]' => ['[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]', '[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]'],
789  ];
790  }
791 
798  public function ‪normalizeExpressionWorksAsExpected(string $expression, string $expectedResult): void
799  {
800  $this->assertSame($expectedResult, $this->conditionMatcher->_call('normalizeExpression', $expression));
801  }
802 }
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsStringBoolNull
‪testUserFuncWithMultipleDifferentArgumentsStringBoolNull()
Definition: AbstractConditionMatcherTest.php:475
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStripped
‪testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStripped()
Definition: AbstractConditionMatcherTest.php:670
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithQuotesInside
‪testUserFuncWithQuotesInside()
Definition: AbstractConditionMatcherTest.php:722
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest
Definition: AbstractConditionMatcherTest.php:37
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\expressionDataProvider
‪expressionDataProvider()
Definition: AbstractConditionMatcherTest.php:745
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleArgumentsAndQuotesAndSpaces
‪testUserFuncWithMultipleArgumentsAndQuotesAndSpaces()
Definition: AbstractConditionMatcherTest.php:657
‪TYPO3\CMS\Core\Core\ApplicationContext
Definition: ApplicationContext.php:36
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithIntegerZeroArgument
‪testUserFuncWithIntegerZeroArgument()
Definition: AbstractConditionMatcherTest.php:410
‪TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher
Definition: ConditionMatcher.php:30
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleSoubleQuotedArguments
‪testUserFuncWithMultipleSoubleQuotedArguments()
Definition: AbstractConditionMatcherTest.php:618
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\evaluateConditionCommonReturnsTrueForMatchingContexts
‪evaluateConditionCommonReturnsTrueForMatchingContexts($matchingContextCondition)
Definition: AbstractConditionMatcherTest.php:258
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsStringNullBoolSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsStringNullBoolSingleQuotes()
Definition: AbstractConditionMatcherTest.php:566
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsBoolNullString
‪testUserFuncWithMultipleDifferentArgumentsBoolNullString()
Definition: AbstractConditionMatcherTest.php:501
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\$evaluateExpressionMethod
‪ReflectionMethod $evaluateExpressionMethod
Definition: AbstractConditionMatcherTest.php:52
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsNullBoolStringSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsNullBoolStringSingleQuotes()
Definition: AbstractConditionMatcherTest.php:527
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching
Definition: AbstractConditionMatcherTest.php:3
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleArgumentsAndQuotes
‪testUserFuncWithMultipleArgumentsAndQuotes()
Definition: AbstractConditionMatcherTest.php:644
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithSingleArgument
‪testUserFuncWithSingleArgument()
Definition: AbstractConditionMatcherTest.php:397
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:49
‪TYPO3\CMS\Core\Package\PackageInterface
Definition: PackageInterface.php:21
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithClassMethodCall
‪testUserFuncWithClassMethodCall()
Definition: AbstractConditionMatcherTest.php:735
‪TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher
Definition: AbstractConditionMatcher.php:37
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\Fixtures\GeneralUtilityFixture\setApplicationContext
‪static setApplicationContext($applicationContext)
Definition: GeneralUtilityFixture.php:25
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\initConditionMatcher
‪initConditionMatcher()
Definition: AbstractConditionMatcherTest.php:82
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithQuoteMissing
‪testUserFuncWithQuoteMissing()
Definition: AbstractConditionMatcherTest.php:709
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\notMatchingApplicationContextConditionsDataProvider
‪array notMatchingApplicationContextConditionsDataProvider()
Definition: AbstractConditionMatcherTest.php:279
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\setUp
‪setUp()
Definition: AbstractConditionMatcherTest.php:57
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncIsCalled
‪testUserFuncIsCalled()
Definition: AbstractConditionMatcherTest.php:384
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsBoolNullStringSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsBoolNullStringSingleQuotes()
Definition: AbstractConditionMatcherTest.php:579
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsStringNullBool
‪testUserFuncWithMultipleDifferentArgumentsStringNullBool()
Definition: AbstractConditionMatcherTest.php:488
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStrippedAndEscapes
‪testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStrippedAndEscapes()
Definition: AbstractConditionMatcherTest.php:696
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsNullBoolString
‪testUserFuncWithMultipleDifferentArgumentsNullBoolString()
Definition: AbstractConditionMatcherTest.php:449
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\checkConditionMatcherForDateFunction
‪checkConditionMatcherForDateFunction(string $format, int $expressionValue, bool $expected)
Definition: AbstractConditionMatcherTest.php:158
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\matchingApplicationContextConditionsDataProvider
‪array matchingApplicationContextConditionsDataProvider()
Definition: AbstractConditionMatcherTest.php:243
‪TYPO3\CMS\Core\Cache\CacheManager
Definition: CacheManager.php:34
‪TYPO3\CMS\Core\Http\ServerRequest
Definition: ServerRequest.php:35
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\datesConditionDataProvider
‪array datesConditionDataProvider()
Definition: AbstractConditionMatcherTest.php:106
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\$evaluateConditionCommonMethod
‪ReflectionMethod $evaluateConditionCommonMethod
Definition: AbstractConditionMatcherTest.php:48
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsNullStringBoolSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsNullStringBoolSingleQuotes()
Definition: AbstractConditionMatcherTest.php:540
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\tearDown
‪tearDown()
Definition: AbstractConditionMatcherTest.php:97
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsBoolStringNullSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsBoolStringNullSingleQuotes()
Definition: AbstractConditionMatcherTest.php:592
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\evaluateConditionCommonEvaluatesIpAddressesCorrectly
‪evaluateConditionCommonEvaluatesIpAddressesCorrectly($devIpMask, $actualIp, $expectedResult)
Definition: AbstractConditionMatcherTest.php:369
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\datesFunctionDataProvider
‪array datesFunctionDataProvider()
Definition: AbstractConditionMatcherTest.php:138
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleSingleQuotedArguments
‪testUserFuncWithMultipleSingleQuotedArguments()
Definition: AbstractConditionMatcherTest.php:605
‪TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
Definition: FrontendInterface.php:21
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsStringBoolNullSingleQuotes
‪testUserFuncWithMultipleDifferentArgumentsStringBoolNullSingleQuotes()
Definition: AbstractConditionMatcherTest.php:553
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\checkConditionMatcherForDates
‪checkConditionMatcherForDates(string $expressionMethod, int $expressionValue, bool $expected)
Definition: AbstractConditionMatcherTest.php:126
‪TYPO3\CMS\Core\Log\Logger
Definition: Logger.php:23
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\evaluateConditionCommonDevIpMaskDataProvider
‪array evaluateConditionCommonDevIpMaskDataProvider()
Definition: AbstractConditionMatcherTest.php:316
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithWhitespaceArgument
‪testUserFuncWithWhitespaceArgument()
Definition: AbstractConditionMatcherTest.php:423
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\$conditionMatcher
‪AbstractConditionMatcher PHPUnit_Framework_MockObject_MockObject TYPO3 TestingFramework Core AccessibleObjectInterface $conditionMatcher
Definition: AbstractConditionMatcherTest.php:44
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsNullStringBool
‪testUserFuncWithMultipleDifferentArgumentsNullStringBool()
Definition: AbstractConditionMatcherTest.php:462
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\evaluateConditionCommonReturnsNullForNotMatchingApplicationContexts
‪evaluateConditionCommonReturnsNullForNotMatchingApplicationContexts($notMatchingApplicationContextCondition)
Definition: AbstractConditionMatcherTest.php:295
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleDifferentArgumentsBoolStringNull
‪testUserFuncWithMultipleDifferentArgumentsBoolStringNull()
Definition: AbstractConditionMatcherTest.php:514
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\checkConditionMatcherForHostname
‪checkConditionMatcherForHostname(string $expressionMethod, string $expressionValue, bool $expected)
Definition: AbstractConditionMatcherTest.php:229
‪TYPO3\CMS\Core\Context\DateTimeAspect
Definition: DateTimeAspect.php:33
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\checkConditionMatcherForFeatureFunction
‪checkConditionMatcherForFeatureFunction()
Definition: AbstractConditionMatcherTest.php:172
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\hostnameDataProvider
‪array hostnameDataProvider()
Definition: AbstractConditionMatcherTest.php:213
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithSpacesInQuotes
‪testUserFuncWithSpacesInQuotes()
Definition: AbstractConditionMatcherTest.php:683
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncWithMultipleArguments
‪testUserFuncWithMultipleArguments()
Definition: AbstractConditionMatcherTest.php:436
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\$backupApplicationContext
‪ApplicationContext $backupApplicationContext
Definition: AbstractConditionMatcherTest.php:40
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\normalizeExpressionWorksAsExpected
‪normalizeExpressionWorksAsExpected(string $expression, string $expectedResult)
Definition: AbstractConditionMatcherTest.php:794
‪TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcherTest\testUserFuncReturnsFalse
‪testUserFuncReturnsFalse()
Definition: AbstractConditionMatcherTest.php:631