[TASK] Enable v8 acceptance testing again
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / FormEngine / ElementsBasicInputDateCest.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine;
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
18 use Codeception\Example;
19 use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
20 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
21
22 /**
23 * Tests for "elements_basic" date and time related input fields of ext:styleguide
24 */
25 class ElementsBasicInputDateCest extends AbstractElementsBasicCest
26 {
27 /**
28 * Open list module of styleguide elements basic page
29 *
30 * @param BackendTester $I
31 * @param PageTree $pageTree
32 */
33 public function _before(BackendTester $I, PageTree $pageTree)
34 {
35 $I->useExistingSession('admin');
36
37 $I->click('List');
38 $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
39 $I->switchToContentFrame();
40
41 // Open record and wait until form is ready
42 $I->waitForText('elements basic', 20);
43 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
44 $I->click($editRecordLinkCssPath);
45 $I->waitForElementNotVisible('#t3js-ui-block');
46 $I->waitForText('Edit Form', 3, 'h1');
47 $I->click('inputDateTime');
48 $I->waitForText('inputDateTime', 3);
49 }
50
51 /**
52 * dbTypeDateEvalDate data provider
53 */
54 protected function dbTypeDateEvalDateDataProvider()
55 {
56 return [
57 [
58 // @todo: breaks with too small browser size
59 'label' => 'inputdatetime_2 dbType=date eval=date',
60 'inputValue' => '29-01-2016',
61 'expectedValue' => '29-01-2016',
62 'expectedInternalValue' => '2016-01-29T00:00:00Z',
63 'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
64 'comment' => '',
65 ],
66 [
67 // @todo: breaks with too small browser size
68 'label' => 'inputdatetime_2 dbType=date eval=date',
69 'inputValue' => '13-13-2016',
70 'expectedValue' => '13-01-2017',
71 'expectedInternalValue' => '2017-01-13T00:00:00Z',
72 'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
73 'comment' => '',
74 ],
75 [
76 // @todo: breaks with too small browser size
77 'label' => 'inputdatetime_2 dbType=date eval=date',
78 'inputValue' => '29-02-2016',
79 'expectedValue' => '29-02-2016',
80 'expectedInternalValue' => '2016-02-29T00:00:00Z',
81 'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
82 'comment' => 'Check valid leap year input',
83 ],
84 [
85 // @todo: breaks with too small browser size
86 'label' => 'inputdatetime_2 dbType=date eval=date',
87 'inputValue' => '29-02-2015',
88 'expectedValue' => '01-03-2015',
89 'expectedInternalValue' => '2015-03-01T00:00:00Z',
90 'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
91 'comment' => 'Check invalid leap year transformation',
92 ],
93 ];
94 }
95
96 /**
97 * @dataProvider dbTypeDateEvalDateDataProvider
98 * @param BackendTester $I
99 * @param Example $testData
100 * @todo fix these unstable tests
101 public function dbTypeDateEvalDate(BackendTester $I, Example $testData)
102 {
103 $this->runInputFieldTest($I, $testData);
104 }
105 */
106
107 /**
108 * dbType date eval datetime data provider
109 */
110 protected function dbTypeDateEvalDatetimeDataProvider()
111 {
112 return [
113 [
114 // @todo: breaks with too small browser size
115 'label' => 'inputdatetime_3 eval=datetime',
116 'inputValue' => '05:23 29-01-2016',
117 'expectedValue' => '05:23 29-01-2016',
118 'expectedInternalValue' => '2016-01-29T05:23:00Z',
119 'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
120 'comment' => '',
121 ],
122 [
123 // @todo: breaks with too small browser size
124 'label' => 'inputdatetime_3 eval=datetime',
125 'inputValue' => '05:23 13-13-2016',
126 'expectedValue' => '05:23 13-01-2017',
127 'expectedInternalValue' => '2017-01-13T05:23:00Z',
128 'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
129 'comment' => '',
130 ],
131 [
132 // @todo: breaks with too small browser size
133 'label' => 'inputdatetime_3 eval=datetime',
134 'inputValue' => '05:23 29-02-2016',
135 'expectedValue' => '05:23 29-02-2016',
136 'expectedInternalValue' => '2016-02-29T05:23:00Z',
137 'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
138 'comment' => 'Check valid leap year input',
139 ],
140 [
141 // @todo: breaks with too small browser size
142 'label' => 'inputdatetime_3 eval=datetime',
143 'inputValue' => '05:23 29-02-2015',
144 'expectedValue' => '05:23 01-03-2015',
145 'expectedInternalValue' => '2015-03-01T05:23:00Z',
146 'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
147 'comment' => 'Check invalid leap year transformation',
148 ],
149 ];
150 }
151
152 /**
153 * @dataProvider dbTypeDateEvalDatetimeDataProvider
154 * @param BackendTester $I
155 * @param Example $testData
156 * @todo fix these unstable tests
157 public function dbTypeDateEvalDatetime(BackendTester $I, Example $testData)
158 {
159 $this->runInputFieldTest($I, $testData);
160 }
161 */
162
163 /**
164 * db type date eval time data provider
165 */
166 protected function dbTypeDateEvalTimeDataProvider()
167 {
168 return [
169 [
170 // @todo: breaks with too small browser size
171 'label' => 'inputdatetime_5',
172 'inputValue' => '13:30',
173 'expectedValue' => '13:30',
174 'expectedInternalValue' => '1970-01-01T13:30:00Z',
175 'expectedValueAfterSave' => '1970-01-01T13:30:00+00:00',
176 'comment' => '',
177 ],
178 [
179 // @todo: breaks with too small browser size
180 'label' => 'inputdatetime_5',
181 'inputValue' => '123',
182 'expectedValue' => '12:03',
183 'expectedInternalValue' => '1970-01-01T12:03:00Z',
184 'expectedValueAfterSave' => '1970-01-01T12:03:00+00:00',
185 'comment' => '',
186 ],
187 [
188 // @todo: breaks with too small browser size
189 'label' => 'inputdatetime_5',
190 'inputValue' => '12345',
191 'expectedValue' => '12:34',
192 'expectedInternalValue' => '1970-01-01T12:34:00Z',
193 'expectedValueAfterSave' => '1970-01-01T12:34:00+00:00',
194 'comment' => '',
195 ],
196 [
197 // @todo: breaks with too small browser size
198 'label' => 'inputdatetime_5',
199 'inputValue' => '12:04+5',
200 'expectedValue' => '12:09',
201 'expectedInternalValue' => '1970-01-01T12:09:00Z',
202 'expectedValueAfterSave' => '1970-01-01T12:09:00+00:00',
203 'comment' => '',
204 ],
205 [
206 // @todo: breaks with too small browser size
207 'label' => 'inputdatetime_5',
208 'inputValue' => '12:09-3',
209 'expectedValue' => '12:06',
210 'expectedInternalValue' => '1970-01-01T12:06:00Z',
211 'expectedValueAfterSave' => '1970-01-01T12:06:00+00:00',
212 'comment' => '',
213 ],
214 ];
215 }
216
217 /**
218 * @dataProvider dbTypeDateEvalTimeDataProvider
219 * @param BackendTester $I
220 * @param Example $testData
221 * @todo fix these unstable tests
222 public function dbTypeDateEvalTime(BackendTester $I, Example $testData)
223 {
224 $this->runInputFieldTest($I, $testData);
225 }
226 */
227
228 /**
229 * @param BackendTester $I
230 */
231 /*
232 public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(AcceptanceTester $I)
233 {
234 // @todo fix these unstable tests
235 $dataSets = [
236 'input_37 dbType=datetime eval=datetime' => [
237 [
238 'inputValue' => '05:23 29-01-2016',
239 'expectedValue' => '05:23 29-01-2016',
240 'expectedInternalValue' => '2016-01-29T05:23:00Z',
241 'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
242 'comment' => '',
243 ],
244 [
245 'inputValue' => '05:23 13-13-2016',
246 'expectedValue' => '05:23 13-01-2017',
247 'expectedInternalValue' => '2017-01-13T05:23:00Z',
248 'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
249 'comment' => '',
250 ],
251 [
252 'inputValue' => '05:23 29-02-2016',
253 'expectedValue' => '05:23 29-02-2016',
254 'expectedInternalValue' => '2016-02-29T05:23:00Z',
255 'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
256 'comment' => 'Check valid leap year input',
257 ],
258 [
259 'inputValue' => '05:23 29-02-2015',
260 'expectedValue' => '05:23 01-03-2015',
261 'expectedInternalValue' => '2015-03-01T05:23:00Z',
262 'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
263 'comment' => 'Check invalid leap year transformation',
264 ],
265 ],
266 'input_18 eval=timesec' => [
267 [
268 'inputValue' => '13:30:00',
269 'expectedValue' => '13:30:00',
270 'expectedInternalValue' => '13:30:00',
271 'expectedValueAfterSave' => (new \DateTime('13:30:00'))->getTimestamp(),
272 'comment' => '',
273 ],
274 [
275 'inputValue' => '12345',
276 'expectedValue' => '12:34:05',
277 'expectedInternalValue' => '12:34:05',
278 'expectedValueAfterSave' => (new \DateTime('12:34:05'))->getTimestamp(),
279 'comment' => '',
280 ],
281 [
282 'inputValue' => '12:04:04+5',
283 'expectedValue' => '12:09:04',
284 'expectedInternalValue' => '12:09:04',
285 'expectedValueAfterSave' => (new \DateTime('12:09:04'))->getTimestamp(),
286 'comment' => '',
287 ],
288 ],
289 'input_6 eval=date' => [
290 [
291 'inputValue' => '29-01-2016',
292 'expectedValue' => '29-01-2016',
293 'expectedInternalValue' => '2016-01-29T00:00:00Z',
294 'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
295 'comment' => '',
296 ],
297 [
298 'inputValue' => '13-13-2016',
299 'expectedValue' => '13-01-2017',
300 'expectedInternalValue' => '2017-01-13T00:00:00Z',
301 'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
302 'comment' => '',
303 ],
304 [
305 'inputValue' => '29-02-2016',
306 'expectedValue' => '29-02-2016',
307 'expectedInternalValue' => '2016-02-29T00:00:00Z',
308 'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
309 'comment' => 'Check valid leap year input',
310 ],
311 [
312 'inputValue' => '29-02-2015',
313 'expectedValue' => '01-03-2015',
314 'expectedInternalValue' => '2015-03-01T00:00:00Z',
315 'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
316 'comment' => 'Check invalid leap year transformation',
317 ],
318 ],
319 ];
320 $this->runTests($I, $dataSets);
321 }
322 */
323 }