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