‪TYPO3CMS  10.4
PlainDataResolverTest.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 
22 
24 {
28  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/DataResolving/DataSet/';
29 
30  protected function ‪setUp(): void
31  {
32  parent::setUp();
33  $this->‪importScenarioDataSet('Pages');
34  }
35 
45  public function ‪sortingDataProvider(): array
46  {
47  return [
48  'sorting' => [
49  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
50  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
51  ['sorting']
52  ],
53  'sorting asc' => [
54  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
55  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
56  ['sorting asc']
57  ],
58  'sorting desc' => [
59  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
60  [9, 6, 7, 8, 5, 4, 3, 10, 2, 1],
61  ['sorting desc']
62  ],
63  'sorting ASC' => [
64  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
65  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
66  ['sorting ASC']
67  ],
68  'sorting DESC' => [
69  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
70  [9, 6, 7, 8, 5, 4, 3, 10, 2, 1],
71  ['sorting DESC']
72  ],
73  'sorting ASC title' => [
74  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
75  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
76  ['sorting ASC', 'title']
77  ],
78  'sorting ASC title asc' => [
79  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
80  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
81  ['sorting ASC', 'title asc']
82  ],
83  'sorting ASC title desc' => [
84  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
85  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
86  ['sorting ASC', 'title desc']
87  ],
88  'sorting ASC title ASC' => [
89  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
90  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
91  ['sorting ASC', 'title ASC']
92  ],
93  'sorting ASC title DESC' => [
94  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
95  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
96  ['sorting ASC', 'title DESC']
97  ],
98  'title sorting ASC' => [
99  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
100  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
101  ['title', 'sorting ASC']
102  ],
103  'title asc sorting ASC' => [
104  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
105  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
106  ['title asc', 'sorting ASC']
107  ],
108  'title desc sorting ASC' => [
109  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
110  [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
111  ['title desc', 'sorting ASC']
112  ],
113  'title ASC sorting ASC' => [
114  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
115  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
116  ['title ASC', 'sorting ASC']
117  ],
118  'title DESC sorting ASC' => [
119  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
120  [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
121  ['title DESC', 'sorting ASC']
122  ],
123  ];
124  }
125 
130  public function ‪processSortingReturnsExpectedSequenceOfUids(array $input, array $expected, array $sortings): void
131  {
132  $subject = new PlainDataResolver('pages', [], $sortings);
133  self::assertSame($expected, $subject->processSorting($input));
134  }
135 }
‪TYPO3\CMS\Core\DataHandling\PlainDataResolver
Definition: PlainDataResolver.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest
Definition: PlainDataResolverTest.php:24
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: PlainDataResolverTest.php:27
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\setUp
‪setUp()
Definition: PlainDataResolverTest.php:29
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\processSortingReturnsExpectedSequenceOfUids
‪processSortingReturnsExpectedSequenceOfUids(array $input, array $expected, array $sortings)
Definition: PlainDataResolverTest.php:129
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\sortingDataProvider
‪array sortingDataProvider()
Definition: PlainDataResolverTest.php:44
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving
Definition: PlainDataResolverTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201