/** * * @param TYPO3\CMS\Core\Resource\File $media */ private function initFalFile($media) { $this->record = $media->getProperties(); $this->uid = $media->getUid(); $this->record['fal_file'] = '1'; // Das wird per TS ausgewertet. Die UID ist KEINE Referenz $this->record['uid_local'] = $media->getUid(); $this->record['file_path'] = $media->getPublicUrl(); $this->record['file_abs_url'] = tx_rnbase_util_Misc::getIndpEnv('TYPO3_SITE_URL') . $this->record['file_path']; }
/** * @test */ public function hasPropertyReturnsTrueFilePropertyExists() { $fixture = new \TYPO3\CMS\Core\Resource\File(array('testproperty' => 'testvalue'), $this->storageMock); $this->assertTrue($fixture->hasProperty('testproperty')); }
/** * @test */ public function fileIsAutomaticallyIndexedOnPropertyAccessIfNotAlreadyIndexed() { $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); $this->assertEquals(10, $fixture->getProperty('uid')); }
/** * @test * @dataProvider filenameExtensionDataProvider */ public function getExtensionReturnsCorrectExtension($originalFilename, $expectedBasename, $expectedExtension) { $fixture = new \TYPO3\CMS\Core\Resource\File(array('name' => $originalFilename, 'identifier' => '/' . $originalFilename)); $this->assertSame($expectedExtension, $fixture->getExtension()); }