2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin
;
18 use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree
;
21 * Tests for "elements_basic" simple input fields of ext:styleguide
23 class ElementsBasicInputCest
extends AbstractElementsBasicCest
26 * Set up selects styleguide elements basic page and opens record in FormEngine
29 * @param PageTree $pageTree
31 public function _before(Admin
$I, PageTree
$pageTree)
33 $I->useExistingSession();
35 $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
36 $I->switchToContentFrame();
38 // Open record and wait until form is ready
39 $I->waitForText('elements basic', 20);
40 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
41 $I->click($editRecordLinkCssPath);
42 $I->waitForElementNotVisible('#t3js-ui-block');
43 $I->waitForText('Edit Form', 3, 'h1');
49 public function testFieldHandlingOfSimpleFields(Admin
$I)
54 'inputValue' => 'This is a demo text',
55 'expectedValue' => 'This is a demo text',
56 'expectedInternalValue' => 'This is a demo text',
57 'expectedValueAfterSave' => 'This is a demo text',
61 'input_2, size=10' => [
63 'inputValue' => 'This is a demo text with numbers and other characters 42 #!',
64 'expectedValue' => 'This is a demo text with numbers and other characters 42 #!',
65 'expectedInternalValue' => 'This is a demo text with numbers and other characters 42 #!',
66 'expectedValueAfterSave' => 'This is a demo text with numbers and other characters 42 #!',
72 'inputValue' => 'Kasper',
73 'expectedValue' => 'Kasp',
74 'expectedInternalValue' => 'Kasp',
75 'expectedValueAfterSave' => 'Kasp',
79 'input_4 eval=alpha' => [
81 'inputValue' => 'Kasper = TYPO3',
82 'expectedValue' => 'KasperTYPO',
83 'expectedInternalValue' => 'KasperTYPO',
84 'expectedValueAfterSave' => 'KasperTYPO',
88 'inputValue' => 'Non-latin characters: ŠĐŽĆČ',
89 'expectedValue' => 'Nonlatincharacters',
90 'expectedInternalValue' => 'Nonlatincharacters',
91 'expectedValueAfterSave' => 'Nonlatincharacters',
95 'input_5 eval=alphanum' => [
97 'inputValue' => 'Kasper = TYPO3',
98 'expectedValue' => 'KasperTYPO3',
99 'expectedInternalValue' => 'KasperTYPO3',
100 'expectedValueAfterSave' => 'KasperTYPO3',
104 'input_10 eval=is_in, is_in=abc123' => [
106 'inputValue' => 'abcd1234',
107 'expectedValue' => 'abc123',
108 'expectedInternalValue' => 'abc123',
109 'expectedValueAfterSave' => 'abc123',
113 'inputValue' => 'Kasper TYPO3',
114 'expectedValue' => 'a3',
115 'expectedInternalValue' => 'a3',
116 'expectedValueAfterSave' => 'a3',
120 'input_11 eval=lower' => [
122 'inputValue' => 'Kasper TYPO3!',
123 'expectedValue' => 'kasper typo3!',
124 'expectedInternalValue' => 'kasper typo3!',
125 'expectedValueAfterSave' => 'kasper typo3!',
129 'input_13 eval=nospace' => [
131 'inputValue' => ' Kasper TYPO3! ',
132 'expectedValue' => 'KasperTYPO3!',
133 'expectedInternalValue' => 'KasperTYPO3!',
134 'expectedValueAfterSave' => 'KasperTYPO3!',
138 'input_16 eval=password' => [
140 'inputValue' => 'Kasper',
141 'expectedValue' => '********',
142 'expectedInternalValue' => 'Kasper',
143 'expectedValueAfterSave' => 'Kasper',
147 'input_19 eval=trim' => [
149 'inputValue' => ' Kasper ',
150 'expectedValue' => 'Kasper',
151 'expectedInternalValue' => 'Kasper',
152 'expectedValueAfterSave' => 'Kasper',
156 'inputValue' => ' Kasper TYPO3 ',
157 'expectedValue' => 'Kasper TYPO3',
158 'expectedInternalValue' => 'Kasper TYPO3',
159 'expectedValueAfterSave' => 'Kasper TYPO3',
163 'input_23 eval=upper' => [
165 'inputValue' => 'Kasper TYPO3!',
166 'expectedValue' => 'KASPER TYPO3!',
167 'expectedInternalValue' => 'KASPER TYPO3!',
168 'expectedValueAfterSave' => 'KASPER TYPO3!',
172 'input_24 eval=year' => [
174 'inputValue' => '2016',
175 'expectedValue' => '2016',
176 'expectedInternalValue' => '2016',
177 'expectedValueAfterSave' => '2016',
181 'inputValue' => '12',
182 'expectedValue' => '12',
183 'expectedInternalValue' => '12',
184 'expectedValueAfterSave' => '12',
188 'inputValue' => 'Kasper',
189 'expectedValue' => date('Y'),
190 'expectedInternalValue' => date('Y'),
191 'expectedValueAfterSave' => date('Y'),
192 'comment' => 'Invalid character is converted to current year',
196 $this->runTests($I, $dataSets);
202 public function testHandlingOfEvalFields(Admin
$I)
205 'input_8 eval=double2' => [
207 'inputValue' => '12.335',
208 'expectedValue' => '12.34',
209 'expectedInternalValue' => '12.34',
210 'expectedValueAfterSave' => '12.34',
214 'inputValue' => '12,335', // comma as delimiter
215 'expectedValue' => '12.34',
216 'expectedInternalValue' => '12.34',
217 'expectedValueAfterSave' => '12.34',
221 'inputValue' => '1.1', // comma as delimiter
222 'expectedValue' => '1.10',
223 'expectedInternalValue' => '1.10',
224 'expectedValueAfterSave' => '1.10',
228 'inputValue' => 'TYPO3', // comma as delimiter
229 'expectedValue' => '3.00',
230 'expectedInternalValue' => '3.00',
231 'expectedValueAfterSave' => '3.00',
235 'inputValue' => '3TYPO', // comma as delimiter
236 'expectedValue' => '3.00',
237 'expectedInternalValue' => '3.00',
238 'expectedValueAfterSave' => '3.00',
242 'input_9 eval=int' => [
244 'inputValue' => '12.335',
245 'expectedValue' => '12',
246 'expectedInternalValue' => '12',
247 'expectedValueAfterSave' => '12',
251 'inputValue' => '12,9',
252 'expectedValue' => '12',
253 'expectedInternalValue' => '12',
254 'expectedValueAfterSave' => '12',
258 'inputValue' => 'TYPO3',
259 'expectedValue' => '0',
260 'expectedInternalValue' => '0',
261 'expectedValueAfterSave' => '0',
265 'inputValue' => '3TYPO',
266 'expectedValue' => '3',
267 'expectedInternalValue' => '3',
268 'expectedValueAfterSave' => '3',
272 'input_15 eval=num' => [
274 'inputValue' => '12.335',
275 'expectedValue' => '12335',
276 'expectedInternalValue' => '12335',
277 'expectedValueAfterSave' => '12335',
281 'inputValue' => '12,9',
282 'expectedValue' => '129',
283 'expectedInternalValue' => '129',
284 'expectedValueAfterSave' => '129',
288 'inputValue' => 'TYPO3',
289 'expectedValue' => '3',
290 'expectedInternalValue' => '3',
291 'expectedValueAfterSave' => '3',
295 'inputValue' => '3TYPO',
296 'expectedValue' => '3',
297 'expectedInternalValue' => '3',
298 'expectedValueAfterSave' => '3',
303 $this->runTests($I, $dataSets);
309 public function testHandlingOfRangeAndMd5Fields(Admin
$I)
312 'input_25 eval=int, default=0, range lower=-2, range upper=2' => [
314 'inputValue' => 'Kasper TYPO3',
315 'expectedValue' => '0',
316 'expectedInternalValue' => '0',
317 'expectedValueAfterSave' => '0',
322 'expectedValue' => '2',
323 'expectedInternalValue' => '2',
324 'expectedValueAfterSave' => '2',
328 'inputValue' => '-1',
329 'expectedValue' => '-1',
330 'expectedInternalValue' => '-1',
331 'expectedValueAfterSave' => '-1',
335 'input_12 eval=md5' => [
337 'inputValue' => 'Kasper TYPO3!',
338 'expectedValue' => '748469dd64911af8df8f9a3dcb2c9378',
339 'expectedInternalValue' => '748469dd64911af8df8f9a3dcb2c9378',
340 'expectedValueAfterSave' => '748469dd64911af8df8f9a3dcb2c9378',
344 'inputValue' => ' Kasper TYPO3! ',
345 'expectedValue' => '792a085606250c47d6ebb8c98804d5b0',
346 'expectedInternalValue' => '792a085606250c47d6ebb8c98804d5b0',
347 'expectedValueAfterSave' => '792a085606250c47d6ebb8c98804d5b0',
348 'comment' => 'Check whitespaces are not trimmed.',
352 $this->runTests($I, $dataSets);