‪TYPO3CMS  10.4
BackendConfigurationManagerTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
23 
27 class ‪BackendConfigurationManagerTest extends FunctionalTestCase
28 {
35  {
36  $backendConfigurationManager = $this->getAccessibleMock(BackendConfigurationManager::class, ['getTypoScriptSetup'], [], '', false);
37  $mockTypoScriptService = $this->getMockBuilder(TypoScriptService::class)->getMock();
38  $backendConfigurationManager->_set('typoScriptService', $mockTypoScriptService);
39 
40  (new ‪ConnectionPool())->getConnectionForTable('sys_template')->insert(
41  'sys_template',
42  [
43  'pid' => 123,
44  'deleted' => 0,
45  'hidden' => 0,
46  'root' => 1
47  ]
48  );
49 
50  $actualResult = $backendConfigurationManager->_call('getCurrentPageId');
51  self::assertEquals(123, $actualResult);
52  }
53 
60  {
61  $backendConfigurationManager = $this->getAccessibleMock(BackendConfigurationManager::class, ['getTypoScriptSetup'], [], '', false);
62  $mockTypoScriptService = $this->getMockBuilder(TypoScriptService::class)->getMock();
63  $backendConfigurationManager->_set('typoScriptService', $mockTypoScriptService);
64 
65  (new ‪ConnectionPool())->getConnectionForTable('pages')->insert(
66  'pages',
67  [
68  'deleted' => 0,
69  'hidden' => 0,
70  'is_siteroot' => 1
71  ]
72  );
73 
74  $actualResult = $backendConfigurationManager->_call('getCurrentPageId');
75  self::assertEquals(1, $actualResult);
76  }
77 
84  {
85  $backendConfigurationManager = $this->getAccessibleMock(BackendConfigurationManager::class, ['getTypoScriptSetup'], [], '', false);
86  $mockTypoScriptService = $this->getMockBuilder(TypoScriptService::class)->getMock();
87  $backendConfigurationManager->_set('typoScriptService', $mockTypoScriptService);
88 
90  $actualResult = $backendConfigurationManager->_call('getCurrentPageId');
91  self::assertEquals($expectedResult, $actualResult);
92  }
93 }
‪TYPO3\CMS\Extbase\Tests\Functional\Configuration\BackendConfigurationManagerTest
Definition: BackendConfigurationManagerTest.php:28
‪TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager
Definition: BackendConfigurationManager.php:36
‪TYPO3\CMS\Extbase\Tests\Functional\Configuration\BackendConfigurationManagerTest\getCurrentPageIdReturnsPidFromFirstRootTemplateIfIdIsNotSetAndNoRootPageWasFound
‪getCurrentPageIdReturnsPidFromFirstRootTemplateIfIdIsNotSetAndNoRootPageWasFound()
Definition: BackendConfigurationManagerTest.php:34
‪TYPO3\CMS\Extbase\Tests\Functional\Configuration\BackendConfigurationManagerTest\getCurrentPageIdReturnsUidFromFirstRootPageIfIdIsNotSet
‪getCurrentPageIdReturnsUidFromFirstRootPageIfIdIsNotSet()
Definition: BackendConfigurationManagerTest.php:59
‪TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager
Definition: AbstractConfigurationManager.php:34
‪TYPO3\CMS\Extbase\Tests\Functional\Configuration\BackendConfigurationManagerTest\getCurrentPageIdReturnsDefaultStoragePidIfIdIsNotSetNoRootTemplateAndRootPageWasFound
‪getCurrentPageIdReturnsDefaultStoragePidIfIdIsNotSetNoRootTemplateAndRootPageWasFound()
Definition: BackendConfigurationManagerTest.php:83
‪TYPO3\CMS\Core\TypoScript\TypoScriptService
Definition: TypoScriptService.php:25
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Extbase\Tests\Functional\Configuration
Definition: BackendConfigurationManagerTest.php:16
‪TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager\DEFAULT_BACKEND_STORAGE_PID
‪const DEFAULT_BACKEND_STORAGE_PID
Definition: AbstractConfigurationManager.php:38