diff --git a/typo3/sysext/core/Tests/Unit/Resource/FileTest.php b/typo3/sysext/core/Tests/Unit/Resource/FileTest.php index 495e43c8df8ab473d56011cd64e8d942aed51aa8..42d1c24fa4f2b292f77d43dd0774643c5c4b560f 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/FileTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/FileTest.php @@ -213,28 +213,41 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { * @test */ public function isIndexedTriggersIndexingIfFileIsNotIndexedAlready() { - $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array('loadMetadata'), array(array('identifier' => '/test', 'storage' => 5), $this->storageMock)); - - $mockedRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository'); - $mockedRepository->expects($this->once())->method('findOneByCombinedIdentifier')->will($this->returnValue(FALSE)); - \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository', $mockedRepository); - + $sut = $this->getAccessibleMock( + 'TYPO3\\CMS\\Core\\Resource\\File', + array('loadIndexRecord'), + array(), + '', + FALSE + ); + $sut->_set('indexed', NULL); + $sut->_set('indexingInProgress', FALSE); - $fixture->isIndexed(); + $sut + ->expects($this->once()) + ->method('loadIndexRecord'); + $sut->isIndexed(); } /** * @test */ public function fileIsAutomaticallyIndexedOnPropertyAccessIfNotAlreadyIndexed() { - $fixture = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array('loadMetadata'), array(array('identifier' => '/test', 'storage' => 5), $this->storageMock)); - - $mockedRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository'); - $mockedRepository->expects($this->once())->method('findOneByCombinedIdentifier')->will($this->returnValue(FALSE)); - $mockedRepository->expects($this->once())->method('add'); - \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository', $mockedRepository); - - $fixture->getProperty('uid'); + $sut = $this->getAccessibleMock( + 'TYPO3\\CMS\\Core\\Resource\\File', + array('loadIndexRecord'), + array(), + '', + FALSE + ); + $sut->_set('metaDataProperties', array()); + $sut->_set('properties', array()); + + $sut->_set('indexed', NULL); + $sut + ->expects($this->once()) + ->method('loadIndexRecord'); + $sut->getProperty('foo'); } /**