[BUGFIX] Reallow '0' as valid userFunc argument in TypoScript
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Configuration / TypoScript / ConditionMatching / Fixtures / ConditionMatcherUserFuncs.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 namespace {
16 function user_testFunctionWithNoArgument()
17 {
18 return count(func_get_args()) === 0;
19 }
20
21 function user_testFunctionWithSingleArgument()
22 {
23 return count(func_get_args()) === 1;
24 }
25
26 function user_testFunctionWithThreeArguments()
27 {
28 return count(func_get_args()) === 3;
29 }
30
31 function user_testFunctionWithThreeArgumentsSpaces()
32 {
33 $result = true;
34 foreach (func_get_args() as $argument) {
35 $result &= (trim($argument) == $argument);
36 }
37 return $result;
38 }
39
40 function user_testFunctionWithSpaces($value)
41 {
42 return $value === ' 3, 4, 5, 6 ';
43 }
44
45 function user_testFunction()
46 {
47 return true;
48 }
49
50 function user_testFunctionFalse()
51 {
52 return false;
53 }
54
55 function user_testFunctionWithQuoteMissing($value)
56 {
57 return $value === 'value "';
58 }
59
60 function user_testQuotes($value)
61 {
62 return $value === '1 " 2';
63 }
64
65 class ConditionMatcherUserFunctions
66 {
67 /**
68 * @param mixed $value
69 * @return bool
70 */
71 public static function isTrue($value)
72 {
73 return (bool)$value;
74 }
75 }
76 }