[TASK] Remove TYPO3_DB from Tests 89/49789/2
authorRuud Silvrants <ruudsilvrants@gmail.com>
Fri, 2 Sep 2016 20:11:53 +0000 (22:11 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 2 Sep 2016 20:39:54 +0000 (22:39 +0200)
Resolves: #77803
Releases: master
Change-Id: I804cd5abe1cd23932bf57aeada2b63668c943e6a
Reviewed-on: https://review.typo3.org/49789
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Service/ModuleDataStorageServiceTest.php
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Utility/File/ExtendedFileUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php
typo3/sysext/extbase/Tests/Unit/Utility/ExtensionUtilityTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php
typo3/sysext/install/Tests/Unit/Updates/ContentTypesToTextMediaUpdateTest.php

index 76bc1de..fa4e6df 100644 (file)
@@ -28,7 +28,6 @@ class LogEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $querySettings = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->getMock();
         $objectManager = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
         $objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings));
-        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
         /** @var \TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository|\PHPUnit_Framework_MockObject_MockObject $subject */
         $subject = $this->getMockBuilder(\TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository::class)
index 340fa86..2726526 100644 (file)
@@ -24,10 +24,6 @@ class ModuleDataStorageServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function loadModuleDataReturnsModuleDataObjectForEmptyModuleData()
     {
-        // The test calls several static dependencies that can not be mocked and
-        // call database in the end, so we need to mock the database here.
-        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
-
         // Simulate empty module data
         $GLOBALS['BE_USER'] = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $GLOBALS['BE_USER']->uc = [];
index 3e08d09..be61d0f 100644 (file)
@@ -106,7 +106,6 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         // logoff() call the static factory that has a dependency to a valid BE_USER object. Mock this away
         $GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
         $GLOBALS['BE_USER']->user = ['uid' => $this->getUniqueId()];
-        $GLOBALS['TYPO3_DB'] = $this->createMock(DatabaseConnection::class);
 
         /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */
         $subject = $this->getMockBuilder(BackendUserAuthentication::class)
index 400a6f3..7ee0e1a 100644 (file)
@@ -50,9 +50,6 @@ class ResourceStorageTest extends BaseTestCase
             FileRepository::class,
             $fileRepositoryMock
         );
-        $databaseMock = $this->createMock(DatabaseConnection::class);
-        $databaseMock->expects($this->any())->method('exec_SELECTgetRows')->with('*', 'sys_file_storage', '1=1', '', 'name', '', 'uid')->willReturn([]);
-        $GLOBALS['TYPO3_DB'] = $databaseMock;
     }
 
     protected function tearDown()
index 85ef211..0c6402e 100644 (file)
@@ -36,7 +36,6 @@ class ExtendedFileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $GLOBALS['LANG'] = $this->getMockBuilder(\TYPO3\CMS\Lang\LanguageService::class)
             ->setMethods(['sL'])
             ->getMock();
-        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
     }
 
     /**
index 7ee8daa..6ed206e 100644 (file)
@@ -35,7 +35,6 @@ class BackendConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $this->backendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::class, ['getTypoScriptSetup']);
         $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
         $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
index edf4cdc..465a70a 100644 (file)
@@ -41,9 +41,6 @@ class ExtensionServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     protected function setUp()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMockBuilder(\TYPO3\CMS\Core\Database\DatabaseConnection::class)
-            ->setMethods(['fullQuoteStr', 'exec_SELECTgetRows'])
-            ->getMock();
         $GLOBALS['TSFE'] = new \stdClass();
         $GLOBALS['TSFE']->gr_list = '';
         $this->extensionService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\ExtensionService::class, ['dummy']);
index d3c327d..37d1f19 100644 (file)
@@ -21,10 +21,6 @@ class ExtensionUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     protected function setUp()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMockBuilder(\TYPO3\CMS\Core\Database\DatabaseConnection::class)
-            ->setMethods(['fullQuoteStr', 'exec_SELECTgetRows'])
-            ->getMock();
-
         $GLOBALS['TSFE'] = new \stdClass();
         $GLOBALS['TSFE']->tmpl = new \stdClass();
         $GLOBALS['TSFE']->tmpl->setup = [];
index b863ec7..11b1c33 100644 (file)
@@ -135,8 +135,6 @@ class ContentObjectRendererTest extends UnitTestCase
         $this->frontendControllerMock->page =  [];
         $this->frontendControllerMock->sys_page = $pageRepositoryMock;
         $GLOBALS['TSFE'] = $this->frontendControllerMock;
-        $GLOBALS['TYPO3_DB'] =
-            $this->getMockBuilder(DatabaseConnection::class)->getMock();
 
         $this->subject = $this->getAccessibleMock(
             ContentObjectRenderer::class,
index 4864e05..04df0f8 100644 (file)
@@ -48,9 +48,6 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMockBuilder(\TYPO3\CMS\Core\Database\DatabaseConnection::class)
-            ->setMethods(['exec_SELECTquery', 'sql_fetch_assoc', 'sql_free_result', 'exec_SELECTgetSingleRow'])
-            ->getMock();
         $this->pageSelectObject = $this->getAccessibleMock(\TYPO3\CMS\Frontend\Page\PageRepository::class, ['getMultipleGroupsWhereClause']);
         $this->pageSelectObject->expects($this->any())->method('getMultipleGroupsWhereClause')->will($this->returnValue(' AND 1=1'));
     }
index 02362d7..7bbfd79 100644 (file)
@@ -55,8 +55,6 @@ class ContentTypesToTextMediaUpdateTest extends BaseTestCase
         unset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']);
         $prophet = new Prophet();
         $this->packageManagerProphecy = $prophet->prophesize(PackageManager::class);
-        $this->dbProphecy = $prophet->prophesize(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
-        $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
         $this->updateWizard = new UpdateWizard();
         $this->backupPackageManager = ExtensionManagementUtilityAccessibleProxy::getPackageManager();
         ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());