[BUGFIX] Tests: Release em tests from extbase base class 27/28427/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 15 Mar 2014 19:47:37 +0000 (20:47 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 15 Mar 2014 20:16:14 +0000 (21:16 +0100)
Extbase BaseTestClass comes with a not mocked objectManager that
gives headaches if it is injected to a test subject. Releasing
the extensionmanager test classes from this and using core
UnitTestCase as parent reveals these parts in existing tests,
those are fixed with the patch.

Change-Id: Ia7acd7f838f9ac0eb2f44e0737893fc30c41ff55
Resolves: #56942
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/28427
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
17 files changed:
typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UpdateFromTerControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UploadExtensionFileControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/ExtensionTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/ConfigurationItemRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/RepositoryRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Report/ExtensionStatusTest.php
typo3/sysext/extensionmanager/Tests/Unit/Service/ExtensionManagementServiceTest.php
typo3/sysext/extensionmanager/Tests/Unit/Task/UpdateExtensionListTaskTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ConfigurationUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/EmConfUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ExtensionModelUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ListUtilityTest.php

index 8e690a7..dbd6930 100644 (file)
@@ -107,8 +107,8 @@ class ConfigurationItemRepository {
                } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($configurationOption['type'], 'options')) {
                        $configurationOption = $this->extractInformationForConfigFieldsOfTypeOptions($configurationOption);
                }
-               if (\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($configurationOption['label'], $extensionKey)) {
-                       $configurationOption['label'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($configurationOption['label'], $extensionKey);
+               if ($this->translate($configurationOption['label'], $extensionKey)) {
+                       $configurationOption['label'] = $this->translate($configurationOption['label'], $extensionKey);
                }
                $configurationOption['labels'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $configurationOption['label'], FALSE, 2);
                $configurationOption['subcat_name'] = $configurationOption['subcat_name'] ?: '__default';
@@ -258,4 +258,18 @@ class ConfigurationItemRepository {
                return $configurationObjectStorage;
        }
 
-}
+       /**
+        * Returns the localized label of the LOCAL_LANG key, $key.
+        * Wrapper for the static call.
+        *
+        * @param string $key The key from the LOCAL_LANG array for which to return the value.
+        * @param string $extensionName The name of the extension
+        * @return string|NULL The value from LOCAL_LANG or NULL if no translation was found.
+        */
+       protected function translate($key, $extensionName) {
+               if (\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, $extensionName)) {
+                       $configurationOption['label'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, $extensionName);
+               }
+       }
+
+}
\ No newline at end of file
index 0b07e3a..69551a8 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Controller;
  * Update from TER controller test
  *
  */
-class UpdateFromTerControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class UpdateFromTerControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
index 0364a4b..8f7f55e 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Controller;
  * Update from TER controller test
  *
  */
-class UploadExtensionFileControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class UploadExtensionFileControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @return array The test data for getExtensionFromZipFileExtractsExtensionKey
index 3d2673e..07da196 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Model;
  * Download queue test
  *
  */
-class DownloadQueueTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class DownloadQueueTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @test
index f9d3d1e..c0611db 100644 (file)
@@ -27,7 +27,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Model;
 /**
  * Extension test
  */
-class ExtensionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ExtensionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * Data provider for getCategoryIndexFromStringOrNumberReturnsIndex
index 7134a0e..f854789 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Repository;
  * Tests for ConfigurationItemRepository
  *
  */
-class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -52,7 +52,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                        array('dummy')
                );
 
-               $this->injectedObjectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
+               $this->injectedObjectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface', array(), array(), '', FALSE);
                $this->configurationItemRepository->_set(
                        'objectManager',
                        $this->injectedObjectManagerMock
@@ -63,10 +63,6 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @test
         */
        public function getConfigurationArrayFromExtensionKeyReturnsSortedHierarchicArray() {
-               // due to a static call to LocalisationUtility, that ends up in RootlineUtility, we need to provide this
-               // otherwise a warning is raised
-               // 'Invalid argument supplied for foreach()' in typo3/sysext/core/Classes/Utility/RootlineUtility.php:263
-               $GLOBALS['TCA']['pages']['columns'] = array();
                $flatConfigurationItemArray = array(
                        'item1' => array(
                                'cat' => 'basic',
@@ -105,13 +101,13 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
 
                $configurationItemRepository = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\ConfigurationItemRepository',
-                       array('mergeWithExistingConfiguration')
+                       array('mergeWithExistingConfiguration', 'translate')
                );
                $configurationItemRepository->_set(
                        'objectManager',
                        $this->injectedObjectManagerMock
                );
-               $configurationUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
+               $configurationUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility', array(), array(), '', FALSE);
                $configurationUtilityMock
                        ->expects($this->once())
                        ->method('getDefaultConfigurationFromExtConfTemplateAsValuedArray')
index 90ff183..ad186e2 100644 (file)
@@ -27,9 +27,8 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Repository;
 /**
  * Test case
  *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
  */
-class RepositoryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class RepositoryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
index 3be7c23..0c56903 100644 (file)
@@ -29,7 +29,7 @@ use TYPO3\CMS\Extensionmanager\Report;
 /**
  * Test case
  */
-class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ExtensionStatusTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
@@ -84,7 +84,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function getStatusReturnArrayContainsInstancesOfReportsStatusStatus() {
-               $statusObject = $this->objectManager->get('TYPO3\\CMS\\Reports\\Status', 'title', 'value');
+               $statusObject = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array('title', 'value'));
                /** @var \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus $report */
                $report = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getSecurityStatusOfExtensions', 'getMainRepositoryStatus'), array(), '', FALSE);
                $report->expects($this->any())->method('getMainRepositoryStatus')->will($this->returnValue($statusObject));
@@ -148,13 +148,18 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->once())
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::ERROR)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
-               /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
-               $this->assertSame(\TYPO3\CMS\Reports\Status::ERROR, $result->getSeverity());
+               $this->assertSame($statusMock, $result);
        }
 
        /**
@@ -175,13 +180,19 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->once())
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::NOTICE)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
-               $this->assertSame(\TYPO3\CMS\Reports\Status::NOTICE, $result->getSeverity());
+               $this->assertSame($statusMock, $result);
        }
 
        /**
@@ -202,13 +213,19 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->once())
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
                $result = $mockReport->_call('getMainRepositoryStatus');
-               $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $result->getSeverity());
+               $this->assertSame($statusMock, $result);
        }
 
        /**
@@ -240,14 +257,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(0))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
                $loadedResult = $result->loaded;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $loadedResult->getSeverity());
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -279,14 +302,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(0))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::ERROR)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
                $loadedResult = $result->loaded;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::ERROR, $loadedResult->getSeverity());
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -317,14 +346,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(1))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
-               /** @var $existingResult \TYPO3\CMS\Reports\Status */
-               $existingResult = $result->existing;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $existingResult->getSeverity());
+               /** @var $loadedResult \TYPO3\CMS\Reports\Status */
+               $loadedResult = $result->existing;
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -355,14 +390,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(1))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::WARNING)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
-               /** @var $existingResult \TYPO3\CMS\Reports\Status */
-               $existingResult = $result->existing;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::WARNING, $existingResult->getSeverity());
+               /** @var $loadedResult \TYPO3\CMS\Reports\Status */
+               $loadedResult = $result->existing;
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -394,14 +435,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(2))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
                $loadedResult = $result->loadedoutdated;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $loadedResult->getSeverity());
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -433,14 +480,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(2))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::WARNING)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
                /** @var $loadedResult \TYPO3\CMS\Reports\Status */
                $loadedResult = $result->loadedoutdated;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::WARNING, $loadedResult->getSeverity());
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -471,14 +524,20 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(3))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
-               /** @var $existingResult \TYPO3\CMS\Reports\Status */
-               $existingResult = $result->existingoutdated;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $existingResult->getSeverity());
+               /** @var $loadedResult \TYPO3\CMS\Reports\Status */
+               $loadedResult = $result->existingoutdated;
+               $this->assertSame($statusMock, $loadedResult);
        }
 
        /**
@@ -509,13 +568,19 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
-               $mockReport->_set('objectManager', $this->objectManager);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
+               $this->mockObjectManager
+                       ->expects($this->at(3))
+                       ->method('get')
+                       ->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::WARNING)
+                       ->will($this->returnValue($statusMock));
                $mockReport->_set('listUtility', $mockListUtility);
                $mockReport->_set('languageService', $this->mockLanguageService);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
-               /** @var $existingResult \TYPO3\CMS\Reports\Status */
-               $existingResult = $result->existingoutdated;
-               $this->assertSame(\TYPO3\CMS\Reports\Status::WARNING, $existingResult->getSeverity());
+               /** @var $loadedResult \TYPO3\CMS\Reports\Status */
+               $loadedResult = $result->existingoutdated;
+               $this->assertSame($statusMock, $loadedResult);
        }
 }
index df2de76..f8c64ff 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Service;
  * Testcase
  *
  */
-class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ExtensionManagementServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @test
index cfed159..08aa118 100644 (file)
@@ -27,9 +27,8 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Task;
 /**
  * Test case
  *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
  */
-class UpdateExtensionListTaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class UpdateExtensionListTaskTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var array A backup of registered singleton instances
index 544b850..9a54c22 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  * Configuration utility test
  *
  */
-class ConfigurationUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ConfigurationUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @test
@@ -257,9 +257,9 @@ class ConfigurationUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
         * @return void
         */
        public function convertValuedToNestedConfiguration(array $configuration, array $expected) {
-               /** @var $fixture \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
-               $fixture = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
-               $this->assertEquals($expected, $fixture->convertValuedToNestedConfiguration($configuration));
+               /** @var $subject \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
+               $subject = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility', array('dummy'), array(), '', FALSE);
+               $this->assertEquals($expected, $subject->convertValuedToNestedConfiguration($configuration));
        }
 
        /**
@@ -323,8 +323,8 @@ class ConfigurationUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
         * @return void
         */
        public function convertNestedToValuedConfiguration(array $configuration, array $expected) {
-               /** @var $fixture \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
-               $fixture = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
-               $this->assertEquals($expected, $fixture->convertNestedToValuedConfiguration($configuration));
+               /** @var $subject \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
+               $subject = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility', array('dummy'), array(), '', FALSE);
+               $this->assertEquals($expected, $subject->convertNestedToValuedConfiguration($configuration));
        }
 }
index 03b85cf..39ebf86 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  * Test for DependencyUtility
  *
  */
-class DependencyUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
index fdf67d3..c2c2ae0 100644 (file)
@@ -27,7 +27,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
 /**
  * Test case
  */
-class EmConfUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class EmConfUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @test
index b5ba424..66cc80d 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  * Test for ExtensionModelUtilityTest
  *
  */
-class ExtensionModelUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ExtensionModelUtilityTest extends \TYPO3\CMS\Core\Tests\BaseTestCase {
        /**
         * @test
         * @return void
index e684351..0f3fb3d 100644 (file)
@@ -28,7 +28,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  * Testcase
  *
  */
-class FileHandlingUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class FileHandlingUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var array List of created fake extensions to be deleted in tearDown() again
index 1b128e1..71304ea 100644 (file)
@@ -27,7 +27,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
 /**
  * Test case
  */
-class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class InstallUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var string
index 6b119c9..921151a 100644 (file)
@@ -29,7 +29,7 @@ use TYPO3\CMS\Cms\Package;
  * List utility test
  *
  */
-class ListUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+class ListUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
         * @var \TYPO3\CMS\Extensionmanager\Utility\ListUtility