예제 #1
0
 public function testGetType()
 {
     $asset = new Asset([Asset::ATTR_TYPE => 'image']);
     $this->assertEquals('image', $asset->getType());
     $asset = new Asset([Asset::ATTR_TYPE => 'video']);
     $this->assertEquals('video', $asset->getType());
     $asset = new Asset();
     $this->assertEquals('', $asset->getType());
 }
예제 #2
0
파일: Asset.php 프로젝트: boomcms/boom-core
 /**
  * Return the controller to be used to display an asset.
  *
  * @param Asset $asset
  *
  * @return string
  */
 public static function controller(AssetModel $asset)
 {
     $namespace = 'BoomCMS\\Http\\Controllers\\ViewAsset\\';
     if (!$asset->getExtension()) {
         return;
     }
     $byExtension = $namespace . ucfirst($asset->getExtension());
     if (class_exists($byExtension)) {
         return $byExtension;
     }
     $byType = $namespace . ucfirst($asset->getType());
     if (class_exists($byType)) {
         return $byType;
     }
     return $namespace . 'BaseController';
 }