‪TYPO3CMS  10.4
ElementsBasicInputDateCest.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 
20 use Codeception\Example;
23 
28 {
36  public function ‪_before(‪BackendTester $I, ‪PageTree $pageTree)
37  {
38  $I->useExistingSession('admin');
39 
40  $I->click('List');
41  $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
42  $I->switchToContentFrame();
43 
44  // Open record and wait until form is ready
45  $I->waitForText('elements basic', 20);
46  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
47  $I->click($editRecordLinkCssPath);
48  $I->waitForElementNotVisible('#t3js-ui-block');
49 
50  $I->waitForText('Edit Form', 3, 'h1');
51  // scroll up all the way to get a clean shot to the tab panel
52  $this->‪ensureTopOfFrameIsUsedAndClickTab($I, 'inputDateTime', 'input_23');
53 
54  $I->click('inputDateTime');
55  $I->waitForText('inputDateTime', 3);
56  }
57 
61  protected function ‪dbTypeDateEvalDateDataProvider()
62  {
63  return [
64  [
65  'label' => 'inputdatetime_2',
66  'inputValue' => '29-01-2016',
67  'expectedValue' => '29-01-2016',
68  'expectedInternalValue' => '2016-01-29T00:00:00Z',
69  'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
70  'comment' => 'inputdatetime_2 dbType=date eval=date simple input',
71  ],
72  [
73  'label' => 'inputdatetime_2',
74  'inputValue' => '13-13-2016',
75  'expectedValue' => '13-01-2017',
76  'expectedInternalValue' => '2017-01-13T00:00:00Z',
77  'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
78  'comment' => 'inputdatetime_2 dbType=date eval=date month transformation',
79  ],
80  [
81  'label' => 'inputdatetime_2',
82  'inputValue' => '29-02-2016',
83  'expectedValue' => '29-02-2016',
84  'expectedInternalValue' => '2016-02-29T00:00:00Z',
85  'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
86  'comment' => 'inputdatetime_2 dbType=date eval=date Check valid leap year input',
87  ],
88  [
89  'label' => 'inputdatetime_2',
90  'inputValue' => '29-02-2015',
91  'expectedValue' => '01-03-2015',
92  'expectedInternalValue' => '2015-03-01T00:00:00Z',
93  'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
94  'comment' => 'inputdatetime_2 dbType=date eval=date Check invalid leap year transformation',
95  ],
96  ];
97  }
98 
105  public function ‪dbTypeDateEvalDate(‪BackendTester $I, Example $testData)
106  {
107  $this->‪runInputFieldTest($I, $testData);
108  }
109 
114  {
115  return [
116  [
117  'label' => 'inputdatetime_3',
118  'inputValue' => '05:23 29-01-2016',
119  'expectedValue' => '05:23 29-01-2016',
120  'expectedInternalValue' => '2016-01-29T05:23:00Z',
121  'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
122  'comment' => 'inputdatetime_3 eval=datetime simple input',
123  ],
124  [
125  'label' => 'inputdatetime_3',
126  'inputValue' => '05:23 13-13-2016',
127  'expectedValue' => '05:23 13-01-2017',
128  'expectedInternalValue' => '2017-01-13T05:23:00Z',
129  'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
130  'comment' => 'inputdatetime_3 eval=datetime month transformation',
131  ],
132  [
133  'label' => 'inputdatetime_3',
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' => 'inputdatetime_3 eval=datetime Check valid leap year input',
139  ],
140  [
141  'label' => 'inputdatetime_3',
142  'inputValue' => '05:23 29-02-2015',
143  'expectedValue' => '05:23 01-03-2015',
144  'expectedInternalValue' => '2015-03-01T05:23:00Z',
145  'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
146  'comment' => 'inputdatetime_3 eval=datetime Check invalid leap year transformation',
147  ],
148  ];
149  }
150 
157  public function ‪dbTypeDateEvalDatetime(‪BackendTester $I, Example $testData)
158  {
159  $this->‪runInputFieldTest($I, $testData);
160  }
161 
166  {
167  return [
168  [
169  'label' => 'inputdatetime_5',
170  'inputValue' => '13:30',
171  'expectedValue' => '13:30',
172  'expectedInternalValue' => '1970-01-01T13:30:00Z',
173  'expectedValueAfterSave' => '1970-01-01T13:30:00+00:00',
174  'comment' => 'inputdatetime_5 eval=time time input',
175  ],
176  [
177  'label' => 'inputdatetime_5',
178  'inputValue' => '123',
179  'expectedValue' => '12:03',
180  'expectedInternalValue' => '1970-01-01T12:03:00Z',
181  'expectedValueAfterSave' => '1970-01-01T12:03:00+00:00',
182  'comment' => 'inputdatetime_5 eval=time seconds input',
183  ],
184  [
185  'label' => 'inputdatetime_5',
186  'inputValue' => '12345',
187  'expectedValue' => '12:34',
188  'expectedInternalValue' => '1970-01-01T12:34:00Z',
189  'expectedValueAfterSave' => '1970-01-01T12:34:00+00:00',
190  'comment' => 'inputdatetime_5 eval=time overflow',
191  ],
192  [
193  'label' => 'inputdatetime_5',
194  'inputValue' => '12:04+5',
195  'expectedValue' => '12:09',
196  'expectedInternalValue' => '1970-01-01T12:09:00Z',
197  'expectedValueAfterSave' => '1970-01-01T12:09:00+00:00',
198  'comment' => 'inputdatetime_5 eval=time addition calculation',
199  ],
200  [
201  'label' => 'inputdatetime_5',
202  'inputValue' => '12:09-3',
203  'expectedValue' => '12:06',
204  'expectedInternalValue' => '1970-01-01T12:06:00Z',
205  'expectedValueAfterSave' => '1970-01-01T12:06:00+00:00',
206  'comment' => 'inputdatetime_5 eval=time subtraction calculation',
207  ],
208  ];
209  }
210 
217  public function ‪dbTypeDateEvalTime(‪BackendTester $I, Example $testData)
218  {
219  $this->‪runInputFieldTest($I, $testData);
220  }
221 
226  {
227  return [
228 
229  [
230  'label' => 'inputdatetime_4',
231  'inputValue' => '05:23 29-01-2016',
232  'expectedValue' => '05:23 29-01-2016',
233  'expectedInternalValue' => '2016-01-29T05:23:00Z',
234  'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
235  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime no transformation',
236  ],
237  [
238  'label' => 'inputdatetime_4',
239  'inputValue' => '05:23 13-13-2016',
240  'expectedValue' => '05:23 13-01-2017',
241  'expectedInternalValue' => '2017-01-13T05:23:00Z',
242  'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
243  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime next month',
244  ],
245  [
246  'label' => 'inputdatetime_4',
247  'inputValue' => '05:23 29-02-2016',
248  'expectedValue' => '05:23 29-02-2016',
249  'expectedInternalValue' => '2016-02-29T05:23:00Z',
250  'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
251  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime Check valid leap year input',
252  ],
253  [
254  'label' => 'inputdatetime_4',
255  'inputValue' => '05:23 29-02-2015',
256  'expectedValue' => '05:23 01-03-2015',
257  'expectedInternalValue' => '2015-03-01T05:23:00Z',
258  'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
259  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime Check invalid leap year transformation',
260  ],
261  [
262  'label' => 'inputdatetime_6',
263  'inputValue' => '13:30:00',
264  'expectedValue' => '13:30:00',
265  'expectedInternalValue' => '1970-01-01T13:30:00Z',
266  'expectedValueAfterSave' => '1970-01-01T13:30:00+00:00',
267  'comment' => 'inputdatetime_6 eval=timesec as time',
268  ],
269  [
270  'label' => 'inputdatetime_6',
271  'inputValue' => '12345',
272  'expectedValue' => '12:34:05',
273  'expectedInternalValue' => '1970-01-01T12:34:05Z',
274  'expectedValueAfterSave' => '1970-01-01T12:34:05+00:00',
275  'comment' => 'inputdatetime_6 eval=timesec as timestamp',
276  ],
277  [
278  'label' => 'inputdatetime_6',
279  'inputValue' => '12:04:04+5',
280  'expectedValue' => '12:09:04',
281  'expectedInternalValue' => '1970-01-01T12:09:04Z',
282  'expectedValueAfterSave' => '1970-01-01T12:09:04+00:00',
283  'comment' => 'inputdatetime_6 eval=timesec addition input',
284  ],
285  ];
286  }
287 
295  {
296  $this->‪runInputFieldTest($I, $testData);
297  }
298 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTimeDataProvider_DbTypeDateTime
‪dbTypeDateEvalTimeDataProvider_DbTypeDateTime()
Definition: ElementsBasicInputDateCest.php:225
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTime
‪dbTypeDateEvalTime(BackendTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:217
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTimeDataProvider
‪dbTypeDateEvalTimeDataProvider()
Definition: ElementsBasicInputDateCest.php:165
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDatetimeDataProvider
‪dbTypeDateEvalDatetimeDataProvider()
Definition: ElementsBasicInputDateCest.php:113
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDatetime
‪dbTypeDateEvalDatetime(BackendTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:157
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDate
‪dbTypeDateEvalDate(BackendTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:105
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\_before
‪_before(BackendTester $I, PageTree $pageTree)
Definition: ElementsBasicInputDateCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\AbstractElementsBasicCest\runInputFieldTest
‪runInputFieldTest(BackendTester $I, Example $testData)
Definition: AbstractElementsBasicCest.php:39
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDateDataProvider
‪dbTypeDateEvalDateDataProvider()
Definition: ElementsBasicInputDateCest.php:61
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\AbstractElementsBasicCest\ensureTopOfFrameIsUsedAndClickTab
‪ensureTopOfFrameIsUsedAndClickTab(BackendTester $I, string $tabTitle, string $referenceField)
Definition: AbstractElementsBasicCest.php:136
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\AbstractElementsBasicCest
Definition: AbstractElementsBasicCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest\checkThatValidationWorks_EvalDateTime_DbTypeDateTime
‪checkThatValidationWorks_EvalDateTime_DbTypeDateTime(BackendTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:294
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\ElementsBasicInputDateCest
Definition: ElementsBasicInputDateCest.php:28