‪TYPO3CMS  9.5
PlainDataResolverTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
4 /*
5  * This file is part of TYPO3 GmbHs software toolkit.
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  * The TYPO3 project - inspiring people to share!
12  */
13 
15 
18 
20 {
24  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/DataResolving/DataSet/';
25 
26  protected function ‪setUp()
27  {
28  parent::setUp();
29  $this->‪importScenarioDataSet('Pages');
30  }
31 
41  public function ‪sortingDataProvider(): array
42  {
43  return [
44  'sorting' => [
45  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
46  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
47  ['sorting']
48  ],
49  'sorting asc' => [
50  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
51  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
52  ['sorting asc']
53  ],
54  'sorting desc' => [
55  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
56  [9, 6, 7, 8, 5, 4, 3, 10, 2, 1],
57  ['sorting desc']
58  ],
59  'sorting ASC' => [
60  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
61  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
62  ['sorting ASC']
63  ],
64  'sorting DESC' => [
65  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
66  [9, 6, 7, 8, 5, 4, 3, 10, 2, 1],
67  ['sorting DESC']
68  ],
69  'sorting ASC title' => [
70  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
71  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
72  ['sorting ASC', 'title']
73  ],
74  'sorting ASC title asc' => [
75  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
76  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
77  ['sorting ASC', 'title asc']
78  ],
79  'sorting ASC title desc' => [
80  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
81  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
82  ['sorting ASC', 'title desc']
83  ],
84  'sorting ASC title ASC' => [
85  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
86  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
87  ['sorting ASC', 'title ASC']
88  ],
89  'sorting ASC title DESC' => [
90  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
91  [1, 2, 10, 3, 4, 5, 8, 7, 6, 9],
92  ['sorting ASC', 'title DESC']
93  ],
94  'title sorting ASC' => [
95  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
96  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
97  ['title', 'sorting ASC']
98  ],
99  'title asc sorting ASC' => [
100  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
101  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
102  ['title asc', 'sorting ASC']
103  ],
104  'title desc sorting ASC' => [
105  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
106  [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
107  ['title desc', 'sorting ASC']
108  ],
109  'title ASC sorting ASC' => [
110  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
111  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
112  ['title ASC', 'sorting ASC']
113  ],
114  'title DESC sorting ASC' => [
115  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
116  [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
117  ['title DESC', 'sorting ASC']
118  ],
119  ];
120  }
121 
126  public function ‪processSortingReturnsExpectedSequenceOfUids(array $input, array $expected, array $sortings): void
127  {
128  $subject = new PlainDataResolver('pages', [], $sortings);
129  $this->assertSame($expected, $subject->processSorting($input));
130  }
131 }
‪TYPO3\CMS\Core\DataHandling\PlainDataResolver
Definition: PlainDataResolver.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest
Definition: PlainDataResolverTest.php:20
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: PlainDataResolverTest.php:23
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:33
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\setUp
‪setUp()
Definition: PlainDataResolverTest.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\processSortingReturnsExpectedSequenceOfUids
‪processSortingReturnsExpectedSequenceOfUids(array $input, array $expected, array $sortings)
Definition: PlainDataResolverTest.php:125
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving\PlainDataResolverTest\sortingDataProvider
‪array sortingDataProvider()
Definition: PlainDataResolverTest.php:40
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataResolving
Definition: PlainDataResolverTest.php:14
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:117