‪TYPO3CMS  10.4
DatabaseRecordListTest.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 
23 class ‪DatabaseRecordListTest extends UnitTestCase
24 {
28  protected ‪$subject;
29 
30  protected function ‪setUp(): void
31  {
32  parent::setUp();
33 
34  $this->subject = $this->getAccessibleMock(DatabaseRecordList::class, ['dummy'], [], '', false);
35  }
36 
37  public function ‪visibleColumnsDataProvider(): array
38  {
39  return [
40  'basicTest' => [
41  [
42  'ctrl' => [
43  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
44  ],
45  'types' => [
46  'bullets' => [
47  'showitem' => '--div--;LABEL,--palette--;;general,bodytext;LABEL',
48  ],
49  ],
50  'palettes' => [
51  'general' => [
52  'label' => 'Baz',
53  'showitem' => 'CType;LABEL,colPos;LABEL',
54  ],
55  ],
56  ],
57  'bullets',
58  '--div--;LABEL,CType;LABEL,colPos;LABEL,bodytext;LABEL',
59  ],
60  'linebreaks' => [
61  [
62  'ctrl' => [
63  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
64  ],
65  'types' => [
66  'bullets' => [
67  'showitem' => '--div--;LABEL,
68  --palette--;;general,bodytext;LABEL',
69  ],
70  ],
71  'palettes' => [
72  'general' => [
73  'label' => 'Baz',
74  'showitem' => 'CType;LABEL,colPos;LABEL',
75  ],
76  ],
77  ],
78  'bullets',
79  '--div--;LABEL,
80  CType;LABEL,colPos;LABEL,bodytext;LABEL',
81  ],
82  'spacesInShowItems' => [
83  [
84  'ctrl' => [
85  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
86  ],
87  'types' => [
88  'bullets' => [
89  'showitem' => '--div-- ; LABEL , --palette-- ; ; general , bodytext ; LABEL',
90  ],
91  ],
92  'palettes' => [
93  'general' => [
94  'label' => 'Baz',
95  'showitem' => 'CType ; LABEL , colPos ; LABEL',
96  ],
97  ],
98  ],
99  'bullets',
100  '--div-- ; LABEL , CType ; LABEL , colPos ; LABEL , bodytext ; LABEL',
101  ],
102  'spacesInShowItemsAndLinebreaks' => [
103  [
104  'ctrl' => [
105  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
106  ],
107  'types' => [
108  'bullets' => [
109  'showitem' => '--div-- ; LABEL ,
110  --palette-- ; ; general , bodytext ; LABEL',
111  ],
112  ],
113  'palettes' => [
114  'general' => [
115  'label' => 'Baz',
116  'showitem' => 'CType ; LABEL , colPos ; LABEL',
117  ],
118  ],
119  ],
120  'bullets',
121  '--div-- ; LABEL ,
122  CType ; LABEL , colPos ; LABEL , bodytext ; LABEL',
123  ],
124  'nonExistentPalette' => [
125  [
126  'ctrl' => [
127  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
128  ],
129  'types' => [
130  'bullets' => [
131  'showitem' => '--div--;LABEL,--palette--;;iDoNotExist,bodytext;LABEL',
132  ],
133  ],
134  ],
135  'bullets',
136  '--div--;LABEL,,bodytext;LABEL',
137  ],
138  'trailingCommaInPalette' => [
139  [
140  'ctrl' => [
141  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
142  ],
143  'types' => [
144  'bullets' => [
145  'showitem' => '--div--;LABEL,--palette--;;general,bodytext;LABEL',
146  ],
147  ],
148  'palettes' => [
149  'general' => [
150  'label' => 'Baz',
151  'showitem' => 'CType;LABEL,colPos;LABEL,',
152  ],
153  ],
154  ],
155  'bullets',
156  '--div--;LABEL,CType;LABEL,colPos;LABEL,bodytext;LABEL',
157  ],
158  'trailingSpaceInPalette' => [
159  [
160  'ctrl' => [
161  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
162  ],
163  'types' => [
164  'bullets' => [
165  'showitem' => '--div--;LABEL,--palette--;;general,bodytext;LABEL',
166  ],
167  ],
168  'palettes' => [
169  'general' => [
170  'label' => 'Baz',
171  'showitem' => 'CType;LABEL,colPos;LABEL ',
172  ],
173  ],
174  ],
175  'bullets',
176  '--div--;LABEL,CType;LABEL,colPos;LABEL,bodytext;LABEL',
177  ],
178  'trailingTabInPalette' => [
179  [
180  'ctrl' => [
181  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
182  ],
183  'types' => [
184  'bullets' => [
185  'showitem' => '--div--;LABEL,--palette--;;general,bodytext;LABEL',
186  ],
187  ],
188  'palettes' => [
189  'general' => [
190  'label' => 'Baz',
191  'showitem' => 'CType;LABEL,colPos;LABEL ',
192  ],
193  ],
194  ],
195  'bullets',
196  '--div--;LABEL,CType;LABEL,colPos;LABEL,bodytext;LABEL',
197  ],
198  'trailingLinebreakInPalette' => [
199  [
200  'ctrl' => [
201  'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
202  ],
203  'types' => [
204  'bullets' => [
205  'showitem' => '--div--;LABEL,--palette--;;general,bodytext;LABEL',
206  ],
207  ],
208  'palettes' => [
209  'general' => [
210  'label' => 'Baz',
211  'showitem' => 'CType;LABEL,colPos;LABEL
212  ',
213  ],
214  ],
215  ],
216  'bullets',
217  '--div--;LABEL,CType;LABEL,colPos;LABEL,bodytext;LABEL',
218  ],
219  ];
220  }
221 
229  public function ‪getVisibleColumns(array $tableTCA, string $type, string $expected)
230  {
231  self::assertSame($expected, $this->subject->_call('getVisibleColumns', $tableTCA, $type));
232  }
233 }
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList\DatabaseRecordListTest\getVisibleColumns
‪getVisibleColumns(array $tableTCA, string $type, string $expected)
Definition: DatabaseRecordListTest.php:228
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList\DatabaseRecordListTest\visibleColumnsDataProvider
‪visibleColumnsDataProvider()
Definition: DatabaseRecordListTest.php:36
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList\DatabaseRecordListTest\$subject
‪DatabaseRecordList PHPUnit Framework MockObject MockObject TYPO3 TestingFramework Core AccessibleObjectInterface $subject
Definition: DatabaseRecordListTest.php:27
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList\DatabaseRecordListTest\setUp
‪setUp()
Definition: DatabaseRecordListTest.php:29
‪TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
Definition: DatabaseRecordList.php:57
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList\DatabaseRecordListTest
Definition: DatabaseRecordListTest.php:24
‪TYPO3\CMS\Recordlist\Tests\Unit\RecordList
Definition: DatabaseRecordListTest.php:18