‪TYPO3CMS  ‪main
ElementsBasicNumberCest.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  $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[aria-label="Edit record"]';
43  $I->click($editRecordLinkCssPath);
44  $I->waitForElementNotVisible('#t3js-ui-block');
45  $I->waitForText('Edit Form', 3, 'h1');
46 
47  // Make sure the test operates on the "input" tab
48  $I->click('number');
49  }
50 
54  private function ‪simpleNumberFieldsDataProvider(): array
55  {
56  return [
57  [
58  'label' => 'number_1',
59  'inputValue' => '12.335',
60  'expectedValue' => '12.34',
61  'expectedInternalValue' => '12.34',
62  'expectedValueAfterSave' => '12.34',
63  'comment' => '',
64  ],
65  // @todo Because of reasons, the sent value is not 12,335 but 12335 (without the comma)
66  // Probably the comma is removed (by the webdriver?) and this test fails then.
67  // This is also true for words like "TYPO3". Only the "3" is typed in.
68  /*
69  [
70  'label' => 'number_1',
71  'inputValue' => '12,335', // comma as delimiter
72  'expectedValue' => '12.34',
73  'expectedInternalValue' => '12.34',
74  'expectedValueAfterSave' => '12.34',
75  'comment' => '',
76  ],
77  */
78  [
79  'label' => 'number_1',
80  'inputValue' => '1.1', // dot as delimiter
81  'expectedValue' => '1.10',
82  'expectedInternalValue' => '1.10',
83  'expectedValueAfterSave' => '1.10',
84  'comment' => '',
85  ],
86  // @todo see the todo above.
87  /*
88  [
89  'label' => 'number_1',
90  'inputValue' => 'TYPO3', // word having a number at end
91  'expectedValue' => '3.00',
92  'expectedInternalValue' => '3.00',
93  'expectedValueAfterSave' => '3.00',
94  'comment' => '',
95  ],
96  */
97  // @todo see the todo above.
98  /*
99  [
100  'label' => 'number_1',
101  'inputValue' => '3TYPO', // word having a number in front
102  'expectedValue' => '3.00',
103  'expectedInternalValue' => '3.00',
104  'expectedValueAfterSave' => '3.00',
105  'comment' => '',
106  ],
107  */
108  [
109  'label' => 'number_2',
110  'inputValue' => '12.335',
111  'expectedValue' => '12',
112  'expectedInternalValue' => '12',
113  'expectedValueAfterSave' => '12',
114  'comment' => '',
115  ],
116  // @todo This is nonsense. The comma should be replaced by a dot.
117  // See the todo above.
118  /*
119  [
120  'label' => 'number_2',
121  'inputValue' => '12,9',
122  'expectedValue' => '129',
123  'expectedInternalValue' => '129',
124  'expectedValueAfterSave' => '129',
125  'comment' => '',
126  ],
127  */
128  // @todo see the todo above.
129  /*
130  [
131  'label' => 'number_2',
132  'inputValue' => 'TYPO3',
133  'expectedValue' => '0',
134  'expectedInternalValue' => '0',
135  'expectedValueAfterSave' => '0',
136  'comment' => '',
137  ],
138  */
139  // @todo see the todo above.
140  /*
141  [
142  'label' => 'number_2',
143  'inputValue' => '3TYPO',
144  'expectedValue' => '3',
145  'expectedInternalValue' => '3',
146  'expectedValueAfterSave' => '3',
147  'comment' => '',
148  ],
149  */
150  ];
151  }
152 
153  #[DataProvider('simpleNumberFieldsDataProvider')]
154  public function ‪simpleNumberFields(‪ApplicationTester $I, Example $testData): void
155  {
156  $this->‪runInputFieldTest($I, $testData);
157  }
158 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicNumberCest\simpleNumberFieldsDataProvider
‪simpleNumberFieldsDataProvider()
Definition: ElementsBasicNumberCest.php:54
‪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\ElementsBasicNumberCest
Definition: ElementsBasicNumberCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\AbstractTree\openPath
‪openPath(array $path)
Definition: AbstractTree.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicNumberCest\simpleNumberFields
‪simpleNumberFields(ApplicationTester $I, Example $testData)
Definition: ElementsBasicNumberCest.php:154
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicNumberCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: ElementsBasicNumberCest.php:33
‪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\AbstractElementsBasicCest
Definition: AbstractElementsBasicCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26