[BUGFIX] Tests: Incomplete mock in IndexerServiceTest 23/28423/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 15 Mar 2014 16:13:52 +0000 (17:13 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 15 Mar 2014 16:25:24 +0000 (17:25 +0100)
Change-Id: Idad4b11894ee6e09e0b8eca9a057c7a776925a70
Resolves: #56939
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/28423
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Tests/Unit/Resource/Service/IndexerServiceTest.php

index c4a4696..8f76afc 100644 (file)
@@ -28,9 +28,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Service;
  ***************************************************************/
 
 /**
  ***************************************************************/
 
 /**
- * Testcase for the file indexing service
+ * Test case
  *
  *
- * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
  */
 class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
  */
 class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
@@ -38,8 +37,13 @@ class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function indexFileUpdatesFileProperties() {
         * @test
         */
        public function indexFileUpdatesFileProperties() {
-               /** @var $fixture \TYPO3\CMS\Core\Resource\Service\IndexerService|\PHPUnit_Framework_MockObject_MockObject */
-               $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Service\\IndexerService', array('gatherFileInformation', 'getFileIndexRepository'));
+               $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
+
+               /** @var $subject \TYPO3\CMS\Core\Resource\Service\IndexerService|\PHPUnit_Framework_MockObject_MockObject */
+               $subject = $this->getMock(
+                       'TYPO3\\CMS\\Core\\Resource\\Service\\IndexerService',
+                       array('gatherFileInformation', 'getFileIndexRepository', 'emitPreFileIndexSignal', 'emitPostFileIndexSignal')
+               );
 
                $fileInfo = array(
                        'mount' => 1,
 
                $fileInfo = array(
                        'mount' => 1,
@@ -49,16 +53,16 @@ class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        'sha1' => '123',
                );
 
                        'sha1' => '123',
                );
 
-               $fixture->expects($this->any())->method('gatherFileInformation')->will($this->returnValue($fileInfo));
+               $subject->expects($this->any())->method('gatherFileInformation')->will($this->returnValue($fileInfo));
 
                $repositoryMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
                $repositoryMock->expects($this->any())->method('findByContentHash')->will($this->returnValue(array()));
 
                $repositoryMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
                $repositoryMock->expects($this->any())->method('findByContentHash')->will($this->returnValue(array()));
-               $fixture->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($repositoryMock));
+               $subject->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($repositoryMock));
 
                $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
                $mockedFile->expects($this->once())->method('updateProperties');
 
 
                $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
                $mockedFile->expects($this->once())->method('updateProperties');
 
-               $fixture->indexFile($mockedFile);
+               $subject->indexFile($mockedFile);
        }
 
        /**
        }
 
        /**
@@ -66,21 +70,20 @@ class IndexerServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function indexFileSetsCreationdateAndTimestampPropertiesOfRecordToCurrentExecutionTime() {
                $fileInfo = array();
         */
        public function indexFileSetsCreationdateAndTimestampPropertiesOfRecordToCurrentExecutionTime() {
                $fileInfo = array();
-               /** @var $fixture \TYPO3\CMS\Core\Resource\Service\IndexerService|\PHPUnit_Framework_MockObject_MockObject */
-               $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Service\\IndexerService', array('gatherFileInformation', 'getFileIndexRepository'));
+               /** @var $subject \TYPO3\CMS\Core\Resource\Service\IndexerService|\PHPUnit_Framework_MockObject_MockObject */
+               $subject = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Service\\IndexerService', array('gatherFileInformation', 'getFileIndexRepository'));
 
 
-               $fixture->expects($this->any())->method('gatherFileInformation')->will($this->returnValue($fileInfo));
+               $subject->expects($this->any())->method('gatherFileInformation')->will($this->returnValue($fileInfo));
 
                $repositoryMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
                $repositoryMock->expects($this->any())->method('findByContentHash')->will($this->returnValue(array()));
                $repositoryMock->expects($this->once())->method('add');
 
                $repositoryMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
                $repositoryMock->expects($this->any())->method('findByContentHash')->will($this->returnValue(array()));
                $repositoryMock->expects($this->once())->method('add');
-               $fixture->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($repositoryMock));
+               $subject->expects($this->any())->method('getFileIndexRepository')->will($this->returnValue($repositoryMock));
 
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
 
                $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
 
 
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
 
                $mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
 
-               $fixture->indexFile($mockedFile);
+               $subject->indexFile($mockedFile);
        }
        }
-
-}
+}
\ No newline at end of file