[TASK] Add more fixers for php-cs-fixer
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Regular / CheckValueTestForCheckboxes.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular;
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 use TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
19
20 /**
21 * Functional Test for DataHandlen::checkValue() concerning checkboxes
22 */
23 class CheckValueTestForCheckboxes extends AbstractDataHandlerActionTestCase
24 {
25
26 /**
27 * @var string
28 */
29 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/DataSet/';
30
31 protected function setUp()
32 {
33 $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
34
35 parent::setUp();
36 $this->importScenarioDataSet('LiveDefaultPages');
37 }
38
39 /**
40 * @test
41 */
42 public function checkBoxValueMustBeDefinedInTcaItems()
43 {
44 // pid 88 comes from LiveDefaultPages
45 $result = $this->actionService->createNewRecord('tt_content', 88, [
46 'tx_testdatahandler_checkbox' => '1'
47 ]);
48 $recordUid = $result['tt_content'][0];
49
50 $record = BackendUtility::getRecord('tt_content', $recordUid);
51
52 $this->assertEquals(1, $record['tx_testdatahandler_checkbox']);
53 }
54
55 /**
56 * @test
57 */
58 public function checkBoxValueMustComeFromItemsProcFuncIfNotDefinedInTcaItems()
59 {
60 // pid 88 comes from LiveDefaultPages
61 $result = $this->actionService->createNewRecord('tt_content', 88, [
62 'tx_testdatahandler_checkbox' => '2'
63 ]);
64 $recordUid = $result['tt_content'][0];
65
66 $record = BackendUtility::getRecord('tt_content', $recordUid);
67
68 $this->assertEquals(2, $record['tx_testdatahandler_checkbox']);
69 }
70 }