[BUGFIX] Fix PHP Warnings in Unit Tests
authorBastian Waidelich <bastian@typo3.org>
Fri, 21 Oct 2011 14:18:12 +0000 (16:18 +0200)
committerBastian Waidelich <bastian@typo3.org>
Fri, 21 Oct 2011 14:31:52 +0000 (16:31 +0200)
Some unit tests fail when PHP warnings are not supressed.
This change fixes those.

Change-Id: I497714f5846c719e407beb1f1c92cd70b6d8e2d2

typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php
typo3/sysext/extbase/Tests/Unit/MVC/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Unit/MVC/DispatcherTest.php
typo3/sysext/extbase/Tests/Unit/MVC/Web/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php

index b54da88..7518012 100644 (file)
@@ -93,7 +93,7 @@ class Tx_Extbase_SignalSlot_Dispatcher {
                        'omitSignalInformation' => ($omitSignalInformation === TRUE)
                );
 
-               if (!in_array($slot, $this->slots[$signalClassName][$signalName])) {
+               if (!is_array($this->slots[$signalClassName][$signalName]) || !in_array($slot, $this->slots[$signalClassName][$signalName])) {
                        $this->slots[$signalClassName][$signalName][] = $slot;
                }
        }
index cc63c19..7746ddf 100644 (file)
@@ -60,23 +60,17 @@ class Tx_Extbase_Tests_Unit_MVC_Controller_ActionControllerTest extends Tx_Extba
                $mockUriBuilder = $this->getMock('Tx_Extbase_MVC_Web_Routing_UriBuilder');
                $mockUriBuilder->expects($this->once())->method('setRequest')->with($mockRequest);
 
-               $mockControllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array(), array(), '', FALSE);
-
                $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $mockObjectManager->expects($this->once())->method('create')->with('Tx_Extbase_MVC_Web_Routing_UriBuilder')->will($this->returnValue($mockUriBuilder));
 
                $mockResponse = $this->getMock('Tx_Extbase_MVC_Web_Response', array(), array(), '', FALSE);
 
-               $mockView = $this->getMock('Tx_Extbase_MVC_View_ViewInterface');
-
                $mockController = $this->getAccessibleMock('Tx_Extbase_MVC_Controller_ActionController', array(
                        'initializeFooAction', 'initializeAction', 'resolveActionMethodName', 'initializeActionMethodArguments',
                        'initializeActionMethodValidators', 'mapRequestArgumentsToControllerArguments', 'buildControllerContext',
-                       'resolveView', 'initializeView', 'callActionMethod'),
+                       'resolveView', 'initializeView', 'callActionMethod', 'checkRequestHash'),
                        array(), '', FALSE);
 
-               $this->enableDeprecatedPropertyMapperInController($mockController);
-
                $mockController->_set('objectManager', $mockObjectManager);
                $mockController->expects($this->at(0))->method('resolveActionMethodName')->will($this->returnValue('fooAction'));
                $mockController->expects($this->at(1))->method('initializeActionMethodArguments');
index 46d1582..76bdc74 100644 (file)
@@ -56,11 +56,9 @@ class Tx_Extbase_Tests_Unit_MVC_DispatcherTest extends Tx_Extbase_Tests_Unit_Bas
         */
        public function dispatchThrowsAnInfiniteLoopExceptionIfTheRequestCouldNotBeDispachedAfter99Iterations() {
                $requestCallCounter = 0;
-               /*
                $requestCallBack = function() use (&$requestCallCounter) {
                        return ($requestCallCounter++ < 101) ? FALSE : TRUE;
                };
-                */
                $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface');
                $mockRequest->expects($this->any())->method('isDispatched')->will($this->returnCallBack($requestCallBack, '__invoke'));
 
index a13fc9f..ebd68f2 100644 (file)
@@ -230,7 +230,7 @@ class Tx_Extbase_Tests_Unit_MVC_Web_RequestBuilderTest extends Tx_Extbase_Tests_
         * @expectedException Tx_Extbase_MVC_Exception
         */
        public function buildThrowsExceptionIfControllerConfigurationIsEmptyOrNotSet() {
-               unset($this->configuration['controllerConfiguration']);
+               $this->configuration['controllerConfiguration'] = array();
                $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
                $this->requestBuilder->injectConfigurationManager($this->mockConfigurationManager);
                $this->requestBuilder->injectExtensionService($this->mockExtensionService);
index 4ba1cf9..a7a6a3f 100644 (file)
@@ -107,6 +107,7 @@ class Tx_Extbase_Tests_Unit_Service_ExtensionServiceTest extends Tx_Extbase_Test
        public function tearDown() {
                $GLOBALS['TYPO3_CONF_VARS'] = $this->typo3ConfVars;
                $GLOBALS['TSFE'] = $this->tsfeBackup;
+               $GLOBALS['TYPO3_DB'] = $this->typo3DbBackup;
        }
 
        /**