‪TYPO3CMS  ‪main
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\Attribute\DataProvider;
21 use Codeception\Example;
24 
29 {
33  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
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[aria-label="Edit record"]';
44  $I->click($editRecordLinkCssPath);
45  $I->waitForElementNotVisible('#t3js-ui-block');
46 
47  $I->waitForText('Edit Form', 3, 'h1');
48 
49  // Make sure the test operates on the "inputDateTime" tab
50  $I->click('inputDateTime');
51  }
52 
53  private function ‪dbTypeDateEvalDateDataProvider(): array
54  {
55  return [
56  [
57  'label' => 'inputdatetime_2',
58  'inputValue' => '29-01-2016',
59  'expectedValue' => '29-01-2016',
60  'expectedInternalValue' => '2016-01-29T00:00:00Z',
61  'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
62  'comment' => 'inputdatetime_2 dbType=date eval=date simple input',
63  ],
64  [
65  'label' => 'inputdatetime_2',
66  'inputValue' => '29-02-2016',
67  'expectedValue' => '29-02-2016',
68  'expectedInternalValue' => '2016-02-29T00:00:00Z',
69  'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
70  'comment' => 'inputdatetime_2 dbType=date eval=date Check valid leap year input',
71  ],
72  ];
73  }
74 
75  #[DataProvider('dbTypeDateEvalDateDataProvider')]
76  public function ‪dbTypeDateEvalDate(‪ApplicationTester $I, Example $testData): void
77  {
78  $this->‪runInputFieldTest($I, $testData);
79  }
80 
81  private function ‪dbTypeDateEvalDatetimeDataProvider(): array
82  {
83  return [
84  [
85  'label' => 'inputdatetime_3',
86  'inputValue' => '05:23 29-01-2016',
87  'expectedValue' => '05:23 29-01-2016',
88  'expectedInternalValue' => '2016-01-29T05:23:00Z',
89  'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
90  'comment' => 'inputdatetime_3 eval=datetime simple input',
91  ],
92  [
93  'label' => 'inputdatetime_3',
94  'inputValue' => '05:23 29-02-2016',
95  'expectedValue' => '05:23 29-02-2016',
96  'expectedInternalValue' => '2016-02-29T05:23:00Z',
97  'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
98  'comment' => 'inputdatetime_3 eval=datetime Check valid leap year input',
99  ],
100  [
101  'label' => 'inputdatetime_11',
102  'inputValue' => '',
103  'expectedValue' => '',
104  'expectedInternalValue' => '0',
105  'expectedValueAfterSave' => '0', // Due to casting in FormEngine (string)int:0 => "0"
106  'comment' => 'inputdatetime_11 eval=datetime range.lower=1627208536 Check range validation is ignored',
107  ],
108  ];
109  }
110 
111  #[DataProvider('dbTypeDateEvalDatetimeDataProvider')]
112  public function ‪dbTypeDateEvalDatetime(‪ApplicationTester $I, Example $testData): void
113  {
114  $this->‪runInputFieldTest($I, $testData);
115  }
116 
117  private function ‪dbTypeDateEvalTimeDataProvider(): array
118  {
119  return [
120  [
121  'label' => 'inputdatetime_5',
122  'inputValue' => '13:30',
123  'expectedValue' => '13:30',
124  'expectedInternalValue' => '1970-01-01T13:30:00Z',
125  'expectedValueAfterSave' => '1970-01-01T13:30:00+00:00',
126  'comment' => 'inputdatetime_5 eval=time time input',
127  ],
128  ];
129  }
130 
131  #[DataProvider('dbTypeDateEvalTimeDataProvider')]
132  public function ‪dbTypeDateEvalTime(‪ApplicationTester $I, Example $testData): void
133  {
134  $this->‪runInputFieldTest($I, $testData);
135  }
136 
138  {
139  return [
140  [
141  'label' => 'inputdatetime_4',
142  'inputValue' => '05:23 29-01-2016',
143  'expectedValue' => '05:23 29-01-2016',
144  'expectedInternalValue' => '2016-01-29T05:23:00Z',
145  'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
146  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime no transformation',
147  ],
148  [
149  'label' => 'inputdatetime_4',
150  'inputValue' => '05:23 29-02-2016',
151  'expectedValue' => '05:23 29-02-2016',
152  'expectedInternalValue' => '2016-02-29T05:23:00Z',
153  'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
154  'comment' => 'inputdatetime_4 dbType=datetime eval=datetime Check valid leap year input',
155  ],
156  [
157  'label' => 'inputdatetime_6',
158  'inputValue' => '13:30:00',
159  'expectedValue' => '13:30:00',
160  'expectedInternalValue' => '1970-01-01T13:30:00Z',
161  'expectedValueAfterSave' => '1970-01-01T13:30:00+00:00',
162  'comment' => 'inputdatetime_6 eval=timesec as time',
163  ],
164  ];
165  }
166 
167  #[DataProvider('dbTypeDateEvalTimeDataProvider_DbTypeDateTime')]
169  {
170  $this->‪runInputFieldTest($I, $testData);
171  }
172 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDateDataProvider
‪dbTypeDateEvalDateDataProvider()
Definition: ElementsBasicInputDateCest.php:53
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTimeDataProvider_DbTypeDateTime
‪dbTypeDateEvalTimeDataProvider_DbTypeDateTime()
Definition: ElementsBasicInputDateCest.php:137
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTime
‪dbTypeDateEvalTime(ApplicationTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:132
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDatetime
‪dbTypeDateEvalDatetime(ApplicationTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:112
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDate
‪dbTypeDateEvalDate(ApplicationTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:76
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\checkThatValidationWorks_EvalDateTime_DbTypeDateTime
‪checkThatValidationWorks_EvalDateTime_DbTypeDateTime(ApplicationTester $I, Example $testData)
Definition: ElementsBasicInputDateCest.php:168
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\AbstractTree\openPath
‪openPath(array $path)
Definition: AbstractTree.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalDatetimeDataProvider
‪dbTypeDateEvalDatetimeDataProvider()
Definition: ElementsBasicInputDateCest.php:81
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest
Definition: ElementsBasicInputDateCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest\runInputFieldTest
‪runInputFieldTest(ApplicationTester $I, Example $testData)
Definition: AbstractElementsBasicCest.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\dbTypeDateEvalTimeDataProvider
‪dbTypeDateEvalTimeDataProvider()
Definition: ElementsBasicInputDateCest.php:117
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicInputDateCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: ElementsBasicInputDateCest.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest
Definition: AbstractElementsBasicCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26