‪TYPO3CMS  ‪main
UserTsConfigTest.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;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
25 final class ‪UserTsConfigTest extends UnitTestCase
26 {
28 
29  protected function ‪setUp(): void
30  {
31  parent::setUp();
32  $this->subject = new ‪UserTsConfig();
33  }
34 
35  #[Test]
36  public function ‪addDataSetsUserTypoScriptInResult(): void
37  {
38  $expected = ['foo'];
39  $backendUserAuthenticationMock = $this->createMock(BackendUserAuthentication::class);
40  $backendUserAuthenticationMock->method('getTSConfig')->willReturn($expected);
41  ‪$GLOBALS['BE_USER'] = $backendUserAuthenticationMock;
42  $result = $this->subject->addData([]);
43  self::assertEquals($expected, $result['userTsConfig']);
44  }
45 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\UserTsConfigTest
Definition: UserTsConfigTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\UserTsConfigTest\addDataSetsUserTypoScriptInResult
‪addDataSetsUserTypoScriptInResult()
Definition: UserTsConfigTest.php:36
‪TYPO3\CMS\Backend\Form\FormDataProvider\UserTsConfig
Definition: UserTsConfig.php:25
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\UserTsConfigTest\setUp
‪setUp()
Definition: UserTsConfigTest.php:29
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\UserTsConfigTest\$subject
‪UserTsConfig $subject
Definition: UserTsConfigTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18