public function testPublishFile()
 {
     $app = new TestApplication();
     $app->reset();
     $am = new CAssetManager();
     $am->init($app);
     $path1 = $am->getPublishedPath(__FILE__);
     clearstatcache();
     $this->assertFalse(is_file($path1));
     $url = $am->publish(__FILE__);
     $path2 = $am->getPublishedPath(__FILE__);
     $this->assertEquals($path1, $path2);
     clearstatcache();
     $this->assertTrue(is_file($path1));
     $this->assertEquals(basename($path1), basename(__FILE__));
     $this->assertEquals($url, $am->baseUrl . '/' . basename(dirname($path2)) . '/' . basename($path2));
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!Yii::app()->cache) {
         $this->cachePath = $this->_getPath($this->cachePath, Yii::app()->basePath . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR . 'cache', true);
     }
     if ($this->lessCompile) {
         $this->lessCompiledPath = $this->_getPath($this->lessCompiledPath, 'application.assets.css', true);
     }
     parent::init();
 }
Ejemplo n.º 3
0
 /**
  * Initializes the component.
  */
 public function init()
 {
     $this->setClientScript(Yii::app()->clientScript);
     $this->setCacheBuster(Yii::app()->cacheBuster);
     parent::init();
 }
Ejemplo n.º 4
0
 public function init()
 {
     $this->setBaseUrl(Yii::app()->request->baseUrl . "/index.php/" . self::DEFAULT_BASEPATH);
     parent::init();
 }