‪TYPO3CMS  11.5
QueryGeneratorTest.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 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪QueryGeneratorTest extends UnitTestCase
27 {
32  {
33  return [
34  'multidimensional array input' => [
35  [
36  'foo' => [
37  'bar' => 1,
38  'baz' => [
39  'jane' => 1,
40  'john' => 'doe',
41  ],
42  'fae' => 1,
43  ],
44  'don' => [
45  'dan' => 1,
46  'jim' => [
47  'jon' => 1,
48  'jin' => 'joh',
49  ],
50  ],
51  'one' => [
52  'two' => 1,
53  'three' => [
54  'four' => 1,
55  'five' => 'six',
56  ],
57  ],
58  ],
59  [
60  0 => 'foo',
61  1 => 'bar',
62  ],
63  ],
64  'array with multiple entries input' => [
65  [
66  'foo' => 1,
67  'bar' => 2,
68  'baz' => 3,
69  'don' => 4,
70  ],
71  [
72  0 => 'foo',
73  ],
74  ],
75  'array with one entry input' => [
76  [
77  'foo' => 'bar',
78  ],
79  [
80  0 => 'foo',
81  ],
82  ],
83  'empty array input' => [
84  [],
85  [
86  0 => null,
87  ],
88  ],
89  'empty multidimensional array input' => [
90  [[[[]]], [[]], [[]]],
91  [
92  0 => 0,
93  1 => 0,
94  2 => 0,
95  3 => null,
96  ],
97  ],
98  'null input' => [
99  null,
100  [],
101  ],
102  'string input' => [
103  'foo bar',
104  [],
105  ],
106  'numeric input' => [
107  3.14,
108  [],
109  ],
110  ];
111  }
112 
117  public function ‪getSubscriptReturnsExpectedValues($input, array $expectedArray): void
118  {
119  $subject = $this->getAccessibleMock(QueryGenerator::class, ['dummy'], [], '', false);
120  self::assertSame($expectedArray, $subject->_call('getSubscript', $input));
121  }
122 }
‪TYPO3\CMS\Lowlevel\Database\QueryGenerator
Definition: QueryGenerator.php:49
‪TYPO3\CMS\Lowlevel\Tests\Unit\Database\QueryGeneratorTest\getSubscriptReturnsExpectedValuesDataProvider
‪array getSubscriptReturnsExpectedValuesDataProvider()
Definition: QueryGeneratorTest.php:31
‪TYPO3\CMS\Lowlevel\Tests\Unit\Database
Definition: QueryGeneratorTest.php:18
‪TYPO3\CMS\Lowlevel\Tests\Unit\Database\QueryGeneratorTest
Definition: QueryGeneratorTest.php:27
‪TYPO3\CMS\Lowlevel\Tests\Unit\Database\QueryGeneratorTest\getSubscriptReturnsExpectedValues
‪getSubscriptReturnsExpectedValues($input, array $expectedArray)
Definition: QueryGeneratorTest.php:117