コード例 #1
0
 /**
  *
  * @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'];
 }
コード例 #2
0
ファイル: FileTest.php プロジェクト: khanhdeux/typo3test
 /**
  * @test
  */
 public function hasPropertyReturnsTrueFilePropertyExists()
 {
     $fixture = new \TYPO3\CMS\Core\Resource\File(array('testproperty' => 'testvalue'), $this->storageMock);
     $this->assertTrue($fixture->hasProperty('testproperty'));
 }
コード例 #3
0
ファイル: FileTest.php プロジェクト: noxludo/TYPO3v4-Core
 /**
  * @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'));
 }
コード例 #4
0
ファイル: FileTest.php プロジェクト: nicksergio/TYPO3v4-Core
 /**
  * @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());
 }