Ejemplo n.º 1
0
 /**
  * Create a file asset with an arbitrary path
  *
  * This kind of file is not subject of fallback system
  * Client code is responsible for ensuring that the file is in specified directory
  *
  * @param string $filePath
  * @param string $dirPath
  * @param string $baseDirType
  * @param string $baseUrlType
  * @return File
  */
 public function createArbitrary($filePath, $dirPath, $baseDirType = Filesystem::STATIC_VIEW_DIR, $baseUrlType = UrlInterface::URL_TYPE_STATIC)
 {
     $context = $this->getFileContext($baseDirType, $baseUrlType, $dirPath);
     $contentType = $this->assetSource->getContentType($filePath);
     return new File($this->assetSource, $context, $filePath, '', $contentType);
 }
Ejemplo n.º 2
0
 /**
  * @param string $path
  * @param string $expected
  * @dataProvider getContentTypeDataProvider
  */
 public function testGetContentType($path, $expected)
 {
     $this->assertEquals($expected, $this->object->getContentType($path));
 }
Ejemplo n.º 3
0
 /**
  * Create a file asset with an arbitrary path
  *
  * This kind of file is not subject of fallback system
  * Client code is responsible for ensuring that the file is in specified directory
  *
  * @param string $filePath
  * @param string $dirPath
  * @param string $baseDirType
  * @param string $baseUrlType
  * @return File
  */
 public function createArbitrary($filePath, $dirPath, $baseDirType = DirectoryList::STATIC_VIEW, $baseUrlType = UrlInterface::URL_TYPE_STATIC)
 {
     $context = $this->getFileContext($baseDirType, $baseUrlType, $dirPath);
     $contentType = $this->assetSource->getContentType($filePath);
     return $this->fileFactory->create(['source' => $this->assetSource, 'context' => $context, 'filePath' => $filePath, 'module' => '', 'contentType' => $contentType]);
 }