[TASK] Enable v8 acceptance testing again
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / FormEngine / ElementsBasicInputEvalCest.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" eval input fields of ext:styleguide
24 */
25 class ElementsBasicInputEvalCest 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 $I->click('List');
37 $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
38 $I->switchToContentFrame();
39
40 // Open record and wait until form is ready
41 $I->waitForText('elements basic', 20);
42 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
43 $I->click($editRecordLinkCssPath);
44 $I->waitForElementNotVisible('#t3js-ui-block');
45 $I->waitForText('Edit Form', 3, 'h1');
46 }
47
48 /**
49 * Test various type=input fields having eval
50 */
51 protected function simpleEvalInputFieldsDataProvider()
52 {
53 return [
54 [
55 'label' => 'input_8 eval=double2',
56 'inputValue' => '12.335',
57 'expectedValue' => '12.34',
58 'expectedInternalValue' => '12.34',
59 'expectedValueAfterSave' => '12.34',
60 'comment' => '',
61 ],
62 [
63 'label' => 'input_8 eval=double2',
64 'inputValue' => '12,335', // comma as delimiter
65 'expectedValue' => '12.34',
66 'expectedInternalValue' => '12.34',
67 'expectedValueAfterSave' => '12.34',
68 'comment' => '',
69 ],
70 [
71 'label' => 'input_8 eval=double2',
72 'inputValue' => '1.1', // dot as delimiter
73 'expectedValue' => '1.10',
74 'expectedInternalValue' => '1.10',
75 'expectedValueAfterSave' => '1.10',
76 'comment' => '',
77 ],
78 [
79 'label' => 'input_8 eval=double2',
80 'inputValue' => 'TYPO3', // word having a number at end
81 'expectedValue' => '3.00',
82 'expectedInternalValue' => '3.00',
83 'expectedValueAfterSave' => '3.00',
84 'comment' => '',
85 ],
86 [
87 'label' => 'input_8 eval=double2',
88 'inputValue' => '3TYPO', // word having a number in front
89 'expectedValue' => '3.00',
90 'expectedInternalValue' => '3.00',
91 'expectedValueAfterSave' => '3.00',
92 'comment' => '',
93 ],
94 [
95 'label' => 'input_9 eval=int',
96 'inputValue' => '12.335',
97 'expectedValue' => '12',
98 'expectedInternalValue' => '12',
99 'expectedValueAfterSave' => '12',
100 'comment' => '',
101 ],
102 [
103 'label' => 'input_9 eval=int',
104 'inputValue' => '12,9',
105 'expectedValue' => '12',
106 'expectedInternalValue' => '12',
107 'expectedValueAfterSave' => '12',
108 'comment' => '',
109 ],
110 /**
111 [
112 // @todo this one probably broke with the html type="number" patch
113 'label' => 'input_9 eval=int',
114 'inputValue' => 'TYPO3',
115 'expectedValue' => '0',
116 'expectedInternalValue' => '0',
117 'expectedValueAfterSave' => '0',
118 'comment' => '',
119 ],
120 */
121 [
122 'label' => 'input_9 eval=int',
123 'inputValue' => '3TYPO',
124 'expectedValue' => '3',
125 'expectedInternalValue' => '3',
126 'expectedValueAfterSave' => '3',
127 'comment' => '',
128 ],
129 [
130 'label' => 'input_15 eval=num',
131 'inputValue' => '12.335',
132 'expectedValue' => '12335',
133 'expectedInternalValue' => '12335',
134 'expectedValueAfterSave' => '12335',
135 'comment' => '',
136 ],
137 [
138 'label' => 'input_15 eval=num',
139 'inputValue' => '12,9',
140 'expectedValue' => '129',
141 'expectedInternalValue' => '129',
142 'expectedValueAfterSave' => '129',
143 'comment' => '',
144 ],
145 [
146 'label' => 'input_15 eval=num',
147 'inputValue' => 'TYPO3',
148 'expectedValue' => '3',
149 'expectedInternalValue' => '3',
150 'expectedValueAfterSave' => '3',
151 'comment' => '',
152 ],
153 [
154 'label' => 'input_15 eval=num',
155 'inputValue' => '3TYPO',
156 'expectedValue' => '3',
157 'expectedInternalValue' => '3',
158 'expectedValueAfterSave' => '3',
159 'comment' => '',
160 ],
161 ];
162 }
163
164 /**
165 * @dataProvider simpleEvalInputFieldsDataProvider
166 * @param BackendTester $I
167 * @param Example $testData
168 */
169 public function simpleEvalInputFields(BackendTester $I, Example $testData)
170 {
171 $this->runInputFieldTest($I, $testData);
172 }
173 }