‪TYPO3CMS  ‪main
CheckValueTestForCheckboxesTest.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 PHPUnit\Framework\Attributes\Test;
21 use TYPO3\CMS\Backend\Utility\BackendUtility;
23 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
29 final class ‪CheckValueTestForCheckboxesTest extends FunctionalTestCase
30 {
31  protected array ‪$testExtensionsToLoad = [
32  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler',
33  ];
34 
35  protected function ‪setUp(): void
36  {
37  parent::setUp();
38  $this->importCSVDataSet(__DIR__ . '/DataSet/ImportDefault.csv');
39  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv');
40  $backendUser = $this->setUpBackendUser(1);
41  ‪$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser);
42  }
43 
44  #[Test]
46  {
47  // pid 88 comes from ImportDefault
48  $actionService = new ActionService();
49  $result = $actionService->createNewRecord('tt_content', 88, [
50  'tx_testdatahandler_checkbox' => '1',
51  ]);
52  $recordUid = $result['tt_content'][0];
53  ‪$record = BackendUtility::getRecord('tt_content', $recordUid);
54  self::assertEquals(1, ‪$record['tx_testdatahandler_checkbox']);
55  }
56 
57  #[Test]
59  {
60  // pid 88 comes from ImportDefault
61  $actionService = new ActionService();
62  $result = $actionService->createNewRecord('tt_content', 88, [
63  'tx_testdatahandler_checkbox' => '2',
64  ]);
65  $recordUid = $result['tt_content'][0];
66  ‪$record = BackendUtility::getRecord('tt_content', $recordUid);
67  self::assertEquals(2, ‪$record['tx_testdatahandler_checkbox']);
68  }
69 }
‪TYPO3\CMS\Core\Localization\LanguageServiceFactory
Definition: LanguageServiceFactory.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\CheckValueTestForCheckboxesTest\setUp
‪setUp()
Definition: CheckValueTestForCheckboxesTest.php:35
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\CheckValueTestForCheckboxesTest
Definition: CheckValueTestForCheckboxesTest.php:30
‪TYPO3\CMS\Webhooks\Message\$record
‪identifier readonly int readonly array $record
Definition: PageModificationMessage.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\CheckValueTestForCheckboxesTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: CheckValueTestForCheckboxesTest.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\CheckValueTestForCheckboxesTest\checkBoxValueMustBeDefinedInTcaItems
‪checkBoxValueMustBeDefinedInTcaItems()
Definition: CheckValueTestForCheckboxesTest.php:45
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular
Definition: CheckValueTest.php:18
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\CheckValueTestForCheckboxesTest\checkBoxValueMustComeFromItemsProcFuncIfNotDefinedInTcaItems
‪checkBoxValueMustComeFromItemsProcFuncIfNotDefinedInTcaItems()
Definition: CheckValueTestForCheckboxesTest.php:58