[BUGFIX] Adjust unit tests to changes
authorBastian Waidelich <bastian@typo3.org>
Tue, 12 Jul 2011 16:33:49 +0000 (18:33 +0200)
committerBastian Waidelich <bastian@typo3.org>
Tue, 12 Jul 2011 16:33:49 +0000 (18:33 +0200)
Apparently unit tests were not green for a while.
This change fixes this.
Besides it removes "static" modifiers from
TypeHandlingService::isLiteral() and
TypeHandlingService::isSimpleType().

Change-Id: I9ef82ec6c477bf1b5dd29731167ee34e8012404f

typo3/sysext/extbase/Classes/Service/TypeHandlingService.php
typo3/sysext/extbase/Tests/Unit/MVC/Web/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Property/PropertyMapperTest.php
typo3/sysext/extbase/Tests/Unit/Service/CacheServiceTest.php

index 934b0fd..b3a9e1a 100644 (file)
@@ -95,7 +95,7 @@ class Tx_Extbase_Service_TypeHandlingService implements t3lib_Singleton {
         * @param string $type
         * @return boolean
         */
-       static public function isLiteral($type) {
+       public function isLiteral($type) {
                return preg_match(self::LITERAL_TYPE_PATTERN, $type) === 1;
        }
 
@@ -105,7 +105,7 @@ class Tx_Extbase_Service_TypeHandlingService implements t3lib_Singleton {
         * @param string $type
         * @return boolean
         */
-       static public function isSimpleType($type) {
+       public function isSimpleType($type) {
                return in_array(self::normalizeType($type), array('array', 'string', 'float', 'integer', 'boolean'), TRUE);
        }
 
index df82e4b..de09a75 100644 (file)
@@ -279,8 +279,8 @@ class Tx_Extbase_Tests_Unit_MVC_Web_RequestBuilderTest extends Tx_Extbase_Tests_
                                )
                        )
                );
-               $this->mockRequest->expects($this->at(7))->method('setArgument')->with('parameter1', 'value1');
-               $this->mockRequest->expects($this->at(8))->method('setArgument')->with('parameter2', array('parameter3' => 'value3', 'parameter4' => 'value4'));
+               $this->mockRequest->expects($this->at(8))->method('setArgument')->with('parameter1', 'value1');
+               $this->mockRequest->expects($this->at(9))->method('setArgument')->with('parameter2', array('parameter3' => 'value3', 'parameter4' => 'value4'));
 
                $this->requestBuilder->build();
        }
index efd9382..83154e4 100644 (file)
@@ -236,33 +236,6 @@ class Tx_Extbase_Tests_Unit_Persistence_RepositoryTest extends Tx_Extbase_Tests_
        }
 
        /**
-        * @test
-        */
-       public function findByUidQueriesObjectAndRegistersItIfItWasNotFoundInIdentityMap() {
-               $fakeUid = '123';
-               $object = new stdClass();
-               $this->repository->_set('objectType', 'someObjectType');
-
-               $mockQuerySettings = $this->getMock('Tx_Extbase_Persistence_QuerySettingsInterface');
-               $this->mockQuery->expects($this->atLeastOnce())->method('getQuerySettings')->will($this->returnValue($mockQuerySettings));
-
-               $mockQueryResult = $this->getMock('Tx_Extbase_Persistence_QueryResultInterface');
-
-               $this->mockQuery->expects($this->once())->method('equals')->with('uid', $fakeUid)->will($this->returnValue('matchingConstraint'));
-               $this->mockQuery->expects($this->once())->method('matching')->with('matchingConstraint')->will($this->returnValue($this->mockQuery));
-               $this->mockQuery->expects($this->once())->method('execute')->will($this->returnValue($mockQueryResult));
-               $mockQueryResult->expects($this->once())->method('getFirst')->will($this->returnValue($object));
-
-               $this->mockIdentityMap->expects($this->once())->method('hasIdentifier')->with($fakeUid, 'someObjectType')->will($this->returnValue(FALSE));
-               $this->mockIdentityMap->expects($this->once())->method('registerObject')->with($object, $fakeUid);
-               $this->mockQueryFactory->expects($this->once())->method('create')->with('someObjectType')->will($this->returnValue($this->mockQuery));
-
-               $expectedResult = $object;
-               $actualResult = $this->repository->findByUid($fakeUid);
-               $this->assertSame($expectedResult, $actualResult);
-       }
-
-       /**
         * Replacing a reconstituted object (which has a uuid) by a new object
         * will ask the persistence backend to replace them accordingly in the
         * identity map.
index 63152eb..29883a5 100644 (file)
@@ -135,7 +135,6 @@ class Tx_Extbase_Tests_Unit_Property_PropertyMapperTest extends Tx_Extbase_Tests
         * @author Sebastian Kurf├╝rst <sebastian@typo3.org>
         */
        public function findTypeConverterShouldReturnHighestPriorityTypeConverterForSimpleType($source, $targetType, $typeConverters, $expectedTypeConverter) {
-               $this->markTestSkipped('Fixme');
                $mockTypeHandlingService = $this->getMock('Tx_Extbase_Service_TypeHandlingService');
                $mockTypeHandlingService->expects($this->any())->method('isSimpleType')->will($this->returnValue(TRUE));
                $propertyMapper = $this->getAccessibleMock('Tx_Extbase_Property_PropertyMapper', array('dummy'));
index d523ddf..598c414 100644 (file)
@@ -57,6 +57,11 @@ class Tx_Extbase_Tests_Unit_Service_CacheServiceTest extends Tx_Extbase_Tests_Un
                $this->cacheService = $this->getAccessibleMock('Tx_Extbase_Service_CacheService', array('dummy'));
        }
 
+       public function tearDown() {
+               $GLOBALS['TYPO3_DB'] = $this->typo3DbBackup;
+               $GLOBALS['typo3CacheManager'] = $this->cacheManagerBackup;
+       }
+
        /**
         * @test
         */