TYPO3 CMS  TYPO3_7-6
QueryGeneratorTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
29  {
30  return [
31  'multidimensional array input' => [
32  [
33  'foo' => [
34  'bar' => 1,
35  'baz' => [
36  'jane' => 1,
37  'john' => 'doe',
38  ],
39  'fae' => 1,
40  ],
41  'don' => [
42  'dan' => 1,
43  'jim' => [
44  'jon' => 1,
45  'jin' => 'joh',
46  ],
47  ],
48  'one' => [
49  'two' => 1,
50  'three' => [
51  'four' => 1,
52  'five' =>'six',
53  ],
54  ]
55  ],
56  [
57  0 => 'foo',
58  1 => 'bar',
59  ],
60  ],
61  'array with multiple entries input' => [
62  [
63  'foo' => 1,
64  'bar' => 2,
65  'baz' => 3,
66  'don' => 4,
67  ],
68  [
69  0 => 'foo',
70  ],
71  ],
72  'array with one entry input' => [
73  [
74  'foo' => 'bar',
75  ],
76  [
77  0 => 'foo',
78  ],
79  ],
80  'empty array input' => [
81  [],
82  [
83  0 => null,
84  ],
85  ],
86  'empty multidimensional array input' => [
87  [[[[]]], [[]], [[]]],
88  [
89  0 => 0,
90  1 => 0,
91  2 => 0,
92  3 => null,
93  ],
94  ],
95  'null input' => [
96  null,
97  [],
98  ],
99  'string input' => [
100  'foo bar',
101  [],
102  ],
103  'numeric input' => [
104  3.14,
105  [],
106  ],
107  ];
108  }
109 
116  public function getSubscriptReturnsExpectedValues($input, array $expectedArray)
117  {
118  $subject = new QueryGenerator();
119  $this->assertSame($expectedArray, $subject->getSubscript($input));
120  }
121 }