[FEATURE] Follow-Up: Prepare generic persistence for overlay handling 62/23162/7
authorFelix Oertel <fo@lightwerk.com>
Sat, 17 Aug 2013 20:06:05 +0000 (22:06 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 6 Oct 2013 17:42:21 +0000 (19:42 +0200)
Adapt slot connection to now available modifying of arguments.

Resolves: #51106
Releases: 6.2
Change-Id: I871f62e65be231dc3e6908d8becca81591ee4a56
Reviewed-on: https://review.typo3.org/23162
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php
typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UpdateFromTerControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UploadExtensionFileControllerTest.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/InstallUtilityTest.php

index b969bed..025e736 100644 (file)
@@ -27,6 +27,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * A persistence backend. This backend maps objects to the relational model of the storage backend.
  * It persists all added, removed and changed objects.
@@ -182,9 +183,10 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         * @api
         */
        public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeGettingObjectData', array('query' => $query));
+               $signalResult = $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeGettingObjectData', array($query));
+               list($query) = $signalResult;
                $result = $this->storageBackend->getObjectDataByQuery($query);
-               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterGettingObjectData', array('query' => $query, 'result' => &$result));
+               list($query, $result) = $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterGettingObjectData', array($query, $result));
                return $result;
        }
 
index 00daeac..a2070c4 100644 (file)
@@ -123,7 +123,7 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface {
        public function dispatch($signalClassName, $signalName, array $signalArguments = array()) {
                $this->initializeObject();
                if (!isset($this->slots[$signalClassName][$signalName])) {
-                       return NULL;
+                       return $signalArguments;
                }
                foreach ($this->slots[$signalClassName][$signalName] as $slotInformation) {
                        if (isset($slotInformation['object'])) {
index 5a7a7f7..a17e5c6 100644 (file)
@@ -294,8 +294,27 @@ class DispatcherTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
         */
-       public function dispatchReturnsVoidIfSignalNameAndOrSignalClassNameIsNotRegistered() {
-               $this->assertSame(NULL, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal'));
+       public function dispatchReturnsEmptyArrayIfSignalNameAndOrSignalClassNameIsNotRegistered() {
+               $this->assertSame(array(), $this->signalSlotDispatcher->dispatch('ClassA', 'someNotRegisteredSignalName'));
+       }
+
+       /**
+        * @test
+        */
+       public function dispatchReturnsEmptyArrayIfSignalDoesNotProvideAnyArguments() {
+               $this->assertSame(array(), $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal'));
+       }
+
+       /**
+        * @test
+        */
+       public function dispatchReturnsArgumentsArrayAsIsIfSignalIsNotRegistered() {
+               $arguments = array(
+                       'argument1' => 42,
+                       'argument2' => 'a string',
+                       'argument3' => new \stdClass()
+               );
+               $this->assertSame($arguments, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal', $arguments));
        }
 
        /**
index c3971a4..0b07e3a 100644 (file)
@@ -45,10 +45,16 @@ class UpdateFromTerControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
         */
        protected $extensionRepositoryMock;
 
+       /**
+        * @var \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper
+        */
+       protected $repositoryHelperMock;
+
        public function setUp() {
                $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $this->repositoryRepositoryMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository', array('findByUid'), array($this->mockObjectManager));
                $this->extensionRepositoryMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\ExtensionRepository', array(), array($this->mockObjectManager));
+               $this->repositoryHelperMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper', array('updateExtList'), array(), '', FALSE);
        }
 
        /**
@@ -58,16 +64,16 @@ class UpdateFromTerControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
        public function updateExtensionListFromTerCallsUpdateExtListIfExtensionListIsEmpty() {
                $controllerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Controller\\UpdateFromTerController', array('dummy'));
                $repositoryModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository', array('getLastUpdate'));
-               $repositoryHelperMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper', array('updateExtList'));
+
                $viewMock = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('assign'));
                $requestMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Request', array('hasArgument', 'getArgument'));
                $viewMock->expects($this->any())->method('assign')->will($this->returnValue($viewMock));
                $this->repositoryRepositoryMock->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($repositoryModelMock));
-               $repositoryHelperMock->expects($this->once())->method('updateExtList');
+               $this->repositoryHelperMock->expects($this->once())->method('updateExtList');
                $this->extensionRepositoryMock->expects($this->once())->method('countAll')->will($this->returnValue(0));
                $controllerMock->_set('extensionRepository', $this->extensionRepositoryMock);
                $controllerMock->_set('repositoryRepository', $this->repositoryRepositoryMock);
-               $controllerMock->_set('repositoryHelper', $repositoryHelperMock);
+               $controllerMock->_set('repositoryHelper', $this->repositoryHelperMock);
                $controllerMock->_set('settings', array('repositoryUid' => 1));
                $controllerMock->_set('view', $viewMock);
                $controllerMock->_set('request', $requestMock);
@@ -81,16 +87,15 @@ class UpdateFromTerControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
        public function updateExtensionListFromTerDoesNotCallsUpdateExtListIfExtensionListIsNotEmpty() {
                $controllerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Controller\\UpdateFromTerController', array('dummy'));
                $repositoryModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository', array('getLastUpdate'));
-               $repositoryHelperMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper', array('updateExtList'));
                $viewMock = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('assign'));
                $requestMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Request', array('hasArgument', 'getArgument'));
                $viewMock->expects($this->any())->method('assign')->will($this->returnValue($viewMock));
                $this->repositoryRepositoryMock->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($repositoryModelMock));
-               $repositoryHelperMock->expects($this->never())->method('updateExtList');
+               $this->repositoryHelperMock->expects($this->never())->method('updateExtList');
                $this->extensionRepositoryMock->expects($this->once())->method('countAll')->will($this->returnValue(100));
                $controllerMock->_set('extensionRepository', $this->extensionRepositoryMock);
                $controllerMock->_set('repositoryRepository', $this->repositoryRepositoryMock);
-               $controllerMock->_set('repositoryHelper', $repositoryHelperMock);
+               $controllerMock->_set('repositoryHelper', $this->repositoryHelperMock);
                $controllerMock->_set('settings', array('repositoryUid' => 1));
                $controllerMock->_set('view', $viewMock);
                $controllerMock->_set('request', $requestMock);
@@ -104,16 +109,15 @@ class UpdateFromTerControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
        public function updateExtensionListFromTerCallsUpdateExtListIfForceUpdateCheckIsSet() {
                $controllerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Controller\\UpdateFromTerController', array('dummy'));
                $repositoryModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository', array('getLastUpdate'));
-               $repositoryHelperMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper', array('updateExtList'));
                $viewMock = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\TemplateView', array('assign'));
                $requestMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Request', array('hasArgument', 'getArgument'));
                $viewMock->expects($this->any())->method('assign')->will($this->returnValue($viewMock));
                $this->repositoryRepositoryMock->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($repositoryModelMock));
-               $repositoryHelperMock->expects($this->once())->method('updateExtList');
+               $this->repositoryHelperMock->expects($this->once())->method('updateExtList');
                $this->extensionRepositoryMock->expects($this->once())->method('countAll')->will($this->returnValue(100));
                $controllerMock->_set('extensionRepository', $this->extensionRepositoryMock);
                $controllerMock->_set('repositoryRepository', $this->repositoryRepositoryMock);
-               $controllerMock->_set('repositoryHelper', $repositoryHelperMock);
+               $controllerMock->_set('repositoryHelper', $this->repositoryHelperMock);
                $controllerMock->_set('settings', array('repositoryUid' => 1));
                $controllerMock->_set('view', $viewMock);
                $controllerMock->_set('request', $requestMock);
index 244c555..b475eee 100644 (file)
@@ -70,7 +70,7 @@ class UploadExtensionFileControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Ba
         */
        public function getExtensionFromZipFileExtractsExtensionKey($filename, $expectedKey) {
                $fixture = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Controller\\UploadExtensionFileController', array('dummy'));
-               $installUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
+               $installUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array(), array(), '', FALSE);
                $installUtilityMock->expects($this->once())->method('install');
                $fixture->_set('installUtility', $installUtilityMock);
                $fileHandlingUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\FileHandlingUtility');
index fab7945..912ed28 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Report;
-use TYPO3\CMS\Extensionmanager\Report;
 
 /***************************************************************
  *  Copyright notice
@@ -25,6 +24,8 @@ use TYPO3\CMS\Extensionmanager\Report;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Extensionmanager\Report;
+
 /**
  * Test case
  *
@@ -52,7 +53,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function extensionStatusImplementsStatusProviderInterface() {
-               $reportMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus');
+               $reportMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array(), array(), '', FALSE);
                $this->assertInstanceOf('TYPO3\\CMS\\Reports\\StatusProviderInterface', $reportMock);
        }
 
@@ -60,7 +61,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function getStatusReturnsArray() {
-               $report = new Report\ExtensionStatus();
+               $report = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getSecurityStatusOfExtensions', 'getMainRepositoryStatus'), array(), '', FALSE);
                $this->assertInternalType('array', $report->getStatus());
        }
 
@@ -68,7 +69,7 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function getStatusReturnArrayContainsFiveEntries() {
-               $report = new Report\ExtensionStatus();
+               $report = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getSecurityStatusOfExtensions', 'getMainRepositoryStatus'), array(), '', FALSE);
                $this->assertSame(5, count($report->getStatus()));
        }
 
@@ -76,10 +77,15 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function getStatusReturnArrayContainsInstancesOfReportsStatusStatus() {
-               $report = new Report\ExtensionStatus();
+               $statusObject = $this->objectManager->get('TYPO3\\CMS\\Reports\\Status', '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));
                $resultStatuses = $report->getStatus();
                foreach($resultStatuses as $status) {
-                       $this->assertInstanceOf('TYPO3\\CMS\\Reports\\Status', $status);
+                       if ($status) {
+                               $this->assertInstanceOf('TYPO3\\CMS\\Reports\\Status', $status);
+                       }
                }
        }
 
@@ -87,8 +93,32 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function getStatusCallsGetMainRepositoryStatusForMainRepositoryStatusResult() {
+               /** @var $mockTerObject \TYPO3\CMS\Extensionmanager\Domain\Model\Extension|\PHPUnit_Framework_MockObject_MockObject */
+               $mockTerObject = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Extension');
+               $mockTerObject
+                       ->expects($this->any())
+                       ->method('getVersion')
+                       ->will($this->returnValue('1.0.6'));
+               $mockTerObject
+                       ->expects($this->atLeastOnce())
+                       ->method('getReviewState')
+                       ->will($this->returnValue(0));
+               $mockExtensionList = array(
+                       'enetcache' => array(
+                               'installed' => TRUE,
+                               'terObject' => $mockTerObject
+                       ),
+               );
+               /** @var $mockListUtility \TYPO3\CMS\Extensionmanager\Utility\ListUtility|\PHPUnit_Framework_MockObject_MockObject */
+               $mockListUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility');
+               $mockListUtility
+                       ->expects($this->once())
+                       ->method('getAvailableAndInstalledExtensionsWithAdditionalInformation')
+                       ->will($this->returnValue($mockExtensionList));
                /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject */
-               $mockReport = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getMainRepositoryStatus'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('getMainRepositoryStatus'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->mockObjectManager);
+               $mockReport->_set('listUtility', $mockListUtility);
                $mockReport
                        ->expects($this->once())
                        ->method('getMainRepositoryStatus')
@@ -107,7 +137,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue(NULL));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
@@ -132,7 +163,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockRepository));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
@@ -157,7 +189,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockRepository));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
 
                /** @var $result \TYPO3\CMS\Reports\Status */
@@ -193,7 +226,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -230,7 +264,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -266,7 +301,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -302,7 +338,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -339,7 +376,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -376,7 +414,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -412,7 +451,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
@@ -448,7 +488,8 @@ class ExtensionStatusTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->will($this->returnValue($mockExtensionList));
 
                /** @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'));
+               $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
+               $mockReport->_set('objectManager', $this->objectManager);
                $mockReport->_set('listUtility', $mockListUtility);
 
                $result = $mockReport->_call('getSecurityStatusOfExtensions');
index 3036a9e..22dbf95 100644 (file)
@@ -167,7 +167,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $downloadQueue = array(
                        $extensionModelMock
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('uninstall'));
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('uninstall'), array(), '', FALSE);
                $installUtility->expects($this->once())->method('uninstall')->with('foobar');
                $managementMock->_set('installUtility', $installUtility);
                $managementMock->_call('uninstallDependenciesToBeUpdated', $downloadQueue);
@@ -188,7 +188,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $downloadQueue = array(
                        $extensionModelMock
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('uninstall'));
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('uninstall'), array(), '', FALSE);
                $managementMock->_set('installUtility', $installUtility);
                $resolvedDependencies = $managementMock->_call('uninstallDependenciesToBeUpdated', $downloadQueue);
                $this->assertEquals(array('updated' => array('foobar' => $extensionModelMock)), $resolvedDependencies);
@@ -209,7 +209,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                                'siteRelPath' => 'path'
                        )
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install'));
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install'), array(), '', FALSE);
                $installUtility->expects($this->once())->method('install')->with(array(
                        'key' => 'foobar',
                        'siteRelPath' => 'path'
@@ -229,7 +229,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseT
                $installQueue = array(
                        'foobar' => 'foobar'
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install'));
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install'), array(), '', FALSE);
                $installUtility->expects($this->once())->method('install')->with('foobar');
                $managementMock->_set('installUtility', $installUtility);
                $resolvedDependencies = $managementMock->_call('installDependencies', $installQueue);
index 563c2b6..c843e44 100644 (file)
@@ -37,10 +37,16 @@ class UpdateExtensionListTaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
        protected $singletonInstances = array();
 
        /**
+        * @var \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper
+        */
+       protected $repositoryHelper;
+
+       /**
         * Set up
         */
        public function setUp() {
                $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
+               $this->repositoryHelper = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper', array(), array(), '', FALSE);
        }
 
        /**
@@ -62,8 +68,7 @@ class UpdateExtensionListTaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
         * @test
         */
        public function executeCallsUpdateExtListOfRepositoryHelper() {
-               $repositoryHelperMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper');
-               $repositoryHelperMock
+               $this->repositoryHelper
                                ->expects($this->once())
                                ->method('updateExtList');
 
@@ -72,7 +77,7 @@ class UpdateExtensionListTaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
                                ->expects($this->at(0))
                                ->method('get')
                                ->with('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper')
-                               ->will($this->returnValue($repositoryHelperMock));
+                               ->will($this->returnValue($this->repositoryHelper));
 
                $persistenceManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
                $objectManagerMock
@@ -90,14 +95,12 @@ class UpdateExtensionListTaskTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTest
         * @test
         */
        public function executeCallsPersistAllOnPersistenceManager() {
-               $repositoryHelperMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper');
-
                $objectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $objectManagerMock
                        ->expects($this->at(0))
                        ->method('get')
                        ->with('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper')
-                       ->will($this->returnValue($repositoryHelperMock));
+                       ->will($this->returnValue($this->repositoryHelper));
 
                $persistenceManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
                $persistenceManagerMock
index 18ff6da..28e4d5e 100644 (file)
@@ -25,10 +25,10 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
  ***************************************************************/
 
 /**
- * Testcase
- *
+ * Test case
  */
 class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
        /**
         * @var string
         */
@@ -57,21 +57,29 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->extensionData = array(
                        'key' => $this->extensionKey
                );
-               $this->installMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array(
-                       'loadExtension',
-                       'unloadExtension',
-                       'processDatabaseUpdates',
-                       'reloadCaches',
-                       'processCachingFrameworkUpdates',
-                       'saveDefaultConfiguration',
-                       'enrichExtensionWithDetails',
-                       'ensureConfiguredDirectoriesExist',
-                       'importInitialFiles'
-               ));
+               $this->installMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
+                       array(
+                               'loadExtension',
+                               'unloadExtension',
+                               'processDatabaseUpdates',
+                               'reloadCaches',
+                               'processCachingFrameworkUpdates',
+                               'saveDefaultConfiguration',
+                               'enrichExtensionWithDetails',
+                               'ensureConfiguredDirectoriesExist',
+                               'importInitialFiles'
+                       ),
+                       array(),
+                       '',
+                       FALSE
+               );
+               $dependencyUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility');
+               $this->installMock->_set('dependencyUtility', $dependencyUtility);
                $this->installMock->expects($this->any())
-                               ->method('enrichExtensionWithDetails')
-                               ->with($this->extensionKey)
-                               ->will($this->returnCallback(array($this, 'getExtensionData')));
+                       ->method('enrichExtensionWithDetails')
+                       ->with($this->extensionKey)
+                       ->will($this->returnCallback(array($this, 'getExtensionData')));
        }
 
        /**
@@ -112,8 +120,8 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function installCallsProcessDatabaseUpdates() {
                $this->installMock->expects($this->once())
-                               ->method('processDatabaseUpdates')
-                               ->with($this->extensionData);
+                       ->method('processDatabaseUpdates')
+                       ->with($this->extensionData);
 
                $this->installMock->install($this->extensionKey);
        }
@@ -187,10 +195,16 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $extTablesFile = $extPath . 'ext_tables.sql';
                $fileContent = 'DUMMY TEXT TO COMPARE';
                file_put_contents($extTablesFile, $fileContent);
-               $installMock = $this->getMock(
+               $installMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
-                       array('updateDbWithExtTablesSql', 'importStaticSqlFile', 'importT3DFile')
+                       array('updateDbWithExtTablesSql', 'importStaticSqlFile', 'importT3DFile'),
+                       array(),
+                       '',
+                       FALSE
                );
+               $dependencyUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility');
+               $installMock->_set('dependencyUtility', $dependencyUtility);
+
                $installMock->expects($this->once())->method('updateDbWithExtTablesSql')->with($this->stringStartsWith($fileContent));
                $installMock->processDatabaseUpdates($this->fakedExtensions[$extKey]);
        }
@@ -201,10 +215,15 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        public function processDatabaseUpdatesCallsImportStaticSqlFile() {
                $extKey = $this->createFakeExtension();
                $extRelPath = 'typo3temp/' . $extKey;
-               $installMock = $this->getMock(
+               $installMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
-                       array('importStaticSqlFile', 'updateDbWithExtTablesSql', 'importT3DFile')
+                       array('importStaticSqlFile', 'updateDbWithExtTablesSql', 'importT3DFile'),
+                       array(),
+                       '',
+                       FALSE
                );
+               $dependencyUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility');
+               $installMock->_set('dependencyUtility', $dependencyUtility);
                $installMock->expects($this->once())->method('importStaticSqlFile')->with($extRelPath);
                $installMock->processDatabaseUpdates($this->fakedExtensions[$extKey]);
        }
@@ -217,10 +236,15 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $absPath = PATH_site . $this->fakedExtensions[$extKey]['siteRelPath'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($absPath . '/Initialisation');
                file_put_contents($absPath . '/Initialisation/data.t3d', 'DUMMY');
-               $installMock = $this->getMock(
+               $installMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
-                       array('updateDbWithExtTablesSql', 'importStaticSqlFile', 'importT3DFile')
+                       array('updateDbWithExtTablesSql', 'importStaticSqlFile', 'importT3DFile'),
+                       array(),
+                       '',
+                       FALSE
                );
+               $dependencyUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility');
+               $installMock->_set('dependencyUtility', $dependencyUtility);
                $installMock->expects($this->once())->method('importT3DFile')->with($this->fakedExtensions[$extKey]['siteRelPath']);
                $installMock->processDatabaseUpdates($this->fakedExtensions[$extKey]);
        }
@@ -239,14 +263,18 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        ->method('get')
                        ->with('extensionDataImport', $this->fakedExtensions[$extKey]['siteRelPath'] . '/Initialisation/data.t3d')
                        ->will($this->returnValue(TRUE)
-               );
+                       );
                $installMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
-                       array('getRegistry', 'getImportExportUtility')
+                       array('getRegistry', 'getImportExportUtility'),
+                       array(),
+                       '',
+                       FALSE
                );
+               $dependencyUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility');
+               $installMock->_set('dependencyUtility', $dependencyUtility);
                $installMock->_set('registry', $registryMock);
                $installMock->expects($this->never())->method('getImportExportUtility');
                $installMock->_call('importT3DFile', $this->fakedExtensions[$extKey]['siteRelPath']);
        }
-
 }