[BUGFIX] Naming clash: Fix several unit test failures
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Aug 2012 10:53:43 +0000 (12:53 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Aug 2012 11:11:53 +0000 (13:11 +0200)
The move of classes in Persistence area of extbase to subfolder 'generic'
confused the refactor script a bit. The patch fixes several fatals that
especially occur in the unit test.

Change-Id: I06ae18030e8659ce1251ef87e3d634a65ddbcec4
Resolves: #40150
Related: #40095
Related: #35876
Releases: 6.0
Reviewed-on: http://review.typo3.org/14067
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Persistence/Exception/IllegalObjectTypeException.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnknownObjectException.php
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Classes/Persistence/Generic/IdentityMap.php
typo3/sysext/extbase/Classes/Persistence/Generic/Manager.php
typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php
typo3/sysext/extbase/Classes/Persistence/Generic/ObjectMonitoringInterface.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Service/CacheServiceTest.php

index 4ad994f..51938bc 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Exception;
+namespace TYPO3\CMS\Extbase\Persistence\Exception;
 
 /*                                                                        *
  * This script belongs to the Extbase framework.                          *
@@ -19,7 +19,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Exception;
  * @package Extbase
  * @subpackage Persistence\Exception
  */
-class IllegalObjectTypeException extends \TYPO3\CMS\Extbase\Persistence\Generic\Exception {
+class IllegalObjectTypeException extends \TYPO3\CMS\Extbase\Persistence\Exception {
 
 
 }
index e423d54..64b7744 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Exception;
+namespace TYPO3\CMS\Extbase\Persistence\Exception;
 
 /*                                                                        *
  * This script belongs to the Extbase framework.                          *
@@ -19,7 +19,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Exception;
  * @package Extbase
  * @subpackage Persistence\Exception
  */
-class UnknownObjectException extends \TYPO3\CMS\Extbase\Persistence\Generic\Exception {
+class UnknownObjectException extends \TYPO3\CMS\Extbase\Persistence\Exception {
 
 
 }
index f624ce4..9137862 100644 (file)
@@ -318,7 +318,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        public function replaceObject($existingObject, $newObject) {
                $existingUid = $this->getIdentifierByObject($existingObject);
                if ($existingUid === NULL) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnknownObjectException('The given object is unknown to this persistence backend.', 1238070163);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException('The given object is unknown to this persistence backend.', 1238070163);
                }
                $this->identityMap->unregisterObject($existingObject);
                $this->identityMap->registerObject($newObject, $existingUid);
index 7dd6ddc..14bbe89 100644 (file)
@@ -103,7 +103,7 @@ class IdentityMap implements \TYPO3\CMS\Core\SingletonInterface {
                        throw new \InvalidArgumentException(('Object expected, ' . gettype($object)) . ' given.', 1246892972);
                }
                if (!isset($this->objectMap[$object])) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnknownObjectException(('The given object (class: ' . get_class($object)) . ') is not registered in this Identity Map.', 1246892970);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException(('The given object (class: ' . get_class($object)) . ') is not registered in this Identity Map.', 1246892970);
                }
                return $this->objectMap[$object];
        }
index 4ebcf22..5e62466 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Extbase\Persistence;
+namespace TYPO3\CMS\Extbase\Persistence\Generic;
 
 /***************************************************************
  *  Copyright notice
@@ -34,7 +34,7 @@ namespace TYPO3\CMS\Extbase\Persistence;
  * @version $Id$
  * @api
  */
-class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface, \TYPO3\CMS\Core\SingletonInterface {
+class Manager implements \TYPO3\CMS\Extbase\Persistence\Generic\ManagerInterface, \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * @var \TYPO3\CMS\Extbase\Persistence\BackendInterface
index 5b8e287..f149847 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Extbase\Persistence;
+namespace TYPO3\CMS\Extbase\Persistence\Generic;
 
 /*                                                                        *
  * This script belongs to the Extbase framework.                          *
@@ -20,7 +20,7 @@ namespace TYPO3\CMS\Extbase\Persistence;
  * @subpackage Persistence
  * @deprecated since Extbase 6.0, will be removed in Extbase 7.0
  */
-interface PersistenceManagerInterface extends \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
+interface ManagerInterface extends \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
 {
        /**
         * Returns the current persistence session
index aad5249..b3c04de 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Extbase\Persistence;
+namespace TYPO3\CMS\Extbase\Persistence\Generic;
 
 /***************************************************************
  *  Copyright notice
index d2e6772..ab08876 100644 (file)
@@ -127,7 +127,7 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
         */
        public function add($object) {
                if (!$object instanceof $this->objectType) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException(('The object given to add() was not of the type (' . $this->objectType) . ') this repository manages.', 1248363335);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(('The object given to add() was not of the type (' . $this->objectType) . ') this repository manages.', 1248363335);
                }
                $this->addedObjects->attach($object);
                if ($this->removedObjects->contains($object)) {
@@ -144,7 +144,7 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
         */
        public function remove($object) {
                if (!$object instanceof $this->objectType) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException(('The object given to remove() was not of the type (' . $this->objectType) . ') this repository manages.', 1248363335);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(('The object given to remove() was not of the type (' . $this->objectType) . ') this repository manages.', 1248363335);
                }
                if ($this->addedObjects->contains($object)) {
                        $this->addedObjects->detach($object);
@@ -164,10 +164,10 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
         */
        public function replace($existingObject, $newObject) {
                if (!$existingObject instanceof $this->objectType) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException(('The existing object given to replace was not of the type (' . $this->objectType) . ') this repository manages.', 1248363434);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(('The existing object given to replace was not of the type (' . $this->objectType) . ') this repository manages.', 1248363434);
                }
                if (!$newObject instanceof $this->objectType) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException(('The new object given to replace was not of the type (' . $this->objectType) . ') this repository manages.', 1248363439);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(('The new object given to replace was not of the type (' . $this->objectType) . ') this repository manages.', 1248363439);
                }
                $backend = $this->persistenceManager->getBackend();
                $session = $this->persistenceManager->getSession();
@@ -187,7 +187,7 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
                        $this->addedObjects->detach($existingObject);
                        $this->addedObjects->attach($newObject);
                } else {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnknownObjectException('The "existing object" is unknown to the persistence backend.', 1238068475);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException('The "existing object" is unknown to the persistence backend.', 1238068475);
                }
        }
 
@@ -199,14 +199,14 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
         */
        public function update($modifiedObject) {
                if (!$modifiedObject instanceof $this->objectType) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException(('The modified object given to update() was not of the type (' . $this->objectType) . ') this repository manages.', 1249479625);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(('The modified object given to update() was not of the type (' . $this->objectType) . ') this repository manages.', 1249479625);
                }
                $uid = $modifiedObject->getUid();
                if ($uid !== NULL) {
                        $existingObject = $this->findByUid($uid);
                        $this->replace($existingObject, $modifiedObject);
                } else {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnknownObjectException('The "modified object" is does not have an existing counterpart in this repository.', 1249479819);
+                       throw new \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException('The "modified object" is does not have an existing counterpart in this repository.', 1249479819);
                }
        }
 
index 29435ee..d5b07d8 100644 (file)
@@ -72,7 +72,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
                $this->mockQuery->expects($this->any())->method('getQuerySettings')->will($this->returnValue($this->mockQuerySettings));
                $this->mockQueryFactory->expects($this->any())->method('create')->will($this->returnValue($this->mockQuery));
-               $this->mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
+               $this->mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\ManagerInterface');
                $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
                $this->repository = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Repository', array('dummy'), array($this->mockObjectManager));
                $this->repository->injectIdentityMap($this->mockIdentityMap);
@@ -307,7 +307,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException
+        * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
         */
        public function replaceChecksObjectType() {
                $this->repository->_set('objectType', 'ExpectedObjectType');
@@ -330,7 +330,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnknownObjectException
+        * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
         */
        public function updateRejectsUnknownObjects() {
                $someObject = $this->getMock('TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface');
@@ -341,7 +341,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException
+        * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
         */
        public function updateRejectsObjectsOfWrongType() {
                $this->repository->_set('objectType', 'Foo');
@@ -395,7 +395,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException
+        * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
         */
        public function addChecksObjectType() {
                $this->repository->_set('objectType', 'ExpectedObjectType');
@@ -404,7 +404,7 @@ class RepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        * @expectedException \TYPO3\CMS\Extbase\Persistence\Generic\Exception\IllegalObjectTypeException
+        * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
         */
        public function removeChecksObjectType() {
                $this->repository->_set('objectType', 'ExpectedObjectType');
index b9b2ef1..4a87e07 100644 (file)
@@ -50,7 +50,7 @@ class CacheServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->typo3DbBackup = $GLOBALS['TYPO3_DB'];
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
                $this->cacheManagerBackup = $GLOBALS['typo3CacheManager'];
-               $GLOBALS['typo3CacheManager'] = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Cache_Manager');
+               $GLOBALS['typo3CacheManager'] = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager');
                $this->cacheService = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Service\\CacheService', array('dummy'));
        }
 
@@ -93,7 +93,7 @@ class CacheServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function flushPageCacheUsesCacheManagerToFlushCacheOfSpecifiedPages() {
-               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Cache_frontend_Frontend');
+               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\FrontendInterface');
                $mockCacheFrontend->expects($this->at(0))->method('flushByTag')->with('pageId_1');
                $mockCacheFrontend->expects($this->at(1))->method('flushByTag')->with('pageId_2');
                $mockCacheFrontend->expects($this->at(2))->method('flushByTag')->with('pageId_3');
@@ -105,7 +105,7 @@ class CacheServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function flushPageCacheUsesCacheManagerToFlushCacheOfAllPagesIfPageIdsIsNull() {
-               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Cache_frontend_Frontend');
+               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\FrontendInterface');
                $mockCacheFrontend->expects($this->once())->method('flush');
                $GLOBALS['typo3CacheManager']->expects($this->once())->method('getCache')->with('cache_pages')->will($this->returnValue($mockCacheFrontend));
                $this->cacheService->_call('flushPageCache');
@@ -115,7 +115,7 @@ class CacheServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function flushPageSectionCacheUsesCacheManagerToFlushCacheOfSpecifiedPageSections() {
-               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Cache_frontend_Frontend');
+               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\FrontendInterface');
                $mockCacheFrontend->expects($this->at(0))->method('flushByTag')->with('pageId_1');
                $mockCacheFrontend->expects($this->at(1))->method('flushByTag')->with('pageId_2');
                $mockCacheFrontend->expects($this->at(2))->method('flushByTag')->with('pageId_3');
@@ -127,7 +127,7 @@ class CacheServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @test
         */
        public function flushPageSectionCacheUsesCacheManagerToFlushCacheOfAllPageSectionsIfPageIdsIsNull() {
-               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Cache_frontend_Frontend');
+               $mockCacheFrontend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\FrontendInterface');
                $mockCacheFrontend->expects($this->once())->method('flush');
                $GLOBALS['typo3CacheManager']->expects($this->once())->method('getCache')->with('cache_pagesection')->will($this->returnValue($mockCacheFrontend));
                $this->cacheService->_call('flushPageSectionCache');