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