[FEATURE] Improve userFunc parameter parsing in conditions
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Configuration / ConditionMatcherUserFuncs.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2013 Dmitry Dulepov <dmitry.dulepov@gmail.com>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 namespace {
26 function user_testFunctionWithSingleArgument() {
27 return count(func_get_args()) === 1;
28 }
29
30 function user_testFunctionWithThreeArguments() {
31 return count(func_get_args()) === 3;
32 }
33
34 function user_testFunctionWithThreeArgumentsSpaces() {
35 $result = TRUE;
36 foreach (func_get_args() as $argument) {
37 $result &= (trim($argument) == $argument);
38 }
39 return $result;
40 }
41
42 function user_testFunctionWithSpaces($value) {
43 return $value === ' 3, 4, 5, 6 ';
44 }
45
46 function user_testFunction() {
47 return TRUE;
48 }
49
50 function user_testFunctionFalse() {
51 return FALSE;
52 }
53
54 function user_testFunctionWithQuoteMissing($value) {
55 return $value === 'value "';
56 }
57
58 function user_testQuotes($value) {
59 return $value === '1 " 2';
60 }
61 }
62
63 ?>