Пример #1
0
 public function resolve($asset, Asset $relative = null)
 {
     if ($relative) {
         return AssetFactory::fromAsset($relative, $asset);
     }
     return AssetFactory::fromUrl($asset, $this->_env);
 }
Пример #2
0
 public function testFromAsset()
 {
     $Asset = new CssAsset('css/default.css', $this->file, $this->path);
     $result = AssetFactory::fromAsset($Asset, 'bundle');
     $this->assertInstanceOf('Asset', $result);
     $this->assertEquals('css/bundle.css', $result->url);
     $this->assertEquals($this->path . 'css' . DS . 'bundle.css', $result->file);
     $Asset = new CssAsset('css/app/bundle.css', $this->file, $this->path);
     $result = AssetFactory::fromAsset($Asset, '../bundle');
     $this->assertInstanceOf('Asset', $result);
     $this->assertEquals('css/bundle.css', $result->url);
     $this->assertEquals($this->path . 'css' . DS . 'bundle.css', $result->file);
     $Asset = new CssAsset('css/default.css', $this->file, $this->path);
     $result = AssetFactory::fromAsset($Asset, 'app/bundle');
     $this->assertInstanceOf('Asset', $result);
     $this->assertEquals('css/app/bundle.css', $result->url);
     $this->assertEquals($this->path . 'css' . DS . 'app' . DS . 'bundle.css', $result->file);
     $result = AssetFactory::fromAsset($Asset, '/theme/admin/css/bundle');
     $this->assertInstanceOf('Asset', $result);
     $this->assertEquals('theme/admin/css/bundle.css', $result->url);
     $this->assertEquals(App::themePath('admin') . 'webroot' . DS . 'css' . DS . 'bundle.css', $result->file);
 }