[TASK] Add more fixers for php-cs-fixer
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / DataHandler / SpecialLanguagesTest.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler;
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
18 use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
19
20 /**
21 * Testing behavior of TCA field configuration 'special' => 'languages'
22 */
23 class SpecialLanguagesTest extends AbstractDataHandlerActionTestCase
24 {
25 protected function setUp()
26 {
27 parent::setUp();
28 $this->backendUser->workspace = 0;
29 }
30
31 /**
32 * @param string $value
33 * @param string $expected
34 *
35 * @test
36 * @dataProvider allowedLanguagesAreAssignedToBackendUserGroupDataProvider
37 */
38 public function allowedLanguagesAreAssignedToBackendUserGroup($value, $expected)
39 {
40 $this->actionService->createNewRecord('be_groups', 0, [
41 'title' => 'Testing Group',
42 'allowed_languages' => $value,
43 ]);
44
45 $statement = $this->getConnectionPool()
46 ->getQueryBuilderForTable('be_groups')
47 ->select('allowed_languages')
48 ->from('be_groups')
49 ->where('uid=1')
50 ->execute();
51 $this->assertEquals($expected, $statement->fetchColumn(0));
52 }
53
54 /**
55 * @return array
56 */
57 public function allowedLanguagesAreAssignedToBackendUserGroupDataProvider()
58 {
59 return [
60 'valid languages' => ['1,2', '1,2'],
61 'default language' => ['0', '0'],
62 'empty value' => ['', ''],
63 'invalid integer' => ['not-an-integer', ''],
64 ];
65 }
66 }