/** * Tests if a file is seen as indexed if the record has a uid * * @test */ public function fileIndexStatusIsTrueIfUidIsSet() { $fixture = new \TYPO3\CMS\Core\Resource\File(array('uid' => 1), $this->storageMock); $this->assertTrue($fixture->isIndexed()); }
/** * @test */ public function isIndexedTriggersIndexingIfFileIsNotIndexedAlready() { $fixture = new \TYPO3\CMS\Core\Resource\File(array('identifier' => '/test', 'storage' => 1)); $mockedRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileRepository'); $mockedRepository->expects($this->once())->method('getFileIndexRecord')->will($this->returnValue(FALSE)); $mockedRepository->expects($this->once())->method('addToIndex')->will($this->returnValue(array('uid' => 10))); \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository', $mockedRepository); $fixture->isIndexed(); }