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