|
|
|
@ -28,6 +28,9 @@ class AssetBundleTest extends \yiiunit\TestCase
|
|
|
|
|
Yii::setAlias('@testAssetsPath', '@webroot/assets'); |
|
|
|
|
Yii::setAlias('@testAssetsUrl', '@web/assets'); |
|
|
|
|
Yii::setAlias('@testSourcePath', '@webroot/assetSources'); |
|
|
|
|
Yii::setAlias('@testReadOnlyAssetPath', '@webroot/readOnlyAssets'); |
|
|
|
|
|
|
|
|
|
mkdir(Yii::getAlias('@testReadOnlyAssetPath'), 0555); |
|
|
|
|
|
|
|
|
|
// clean up assets directory |
|
|
|
|
$handle = opendir($dir = Yii::getAlias('@testAssetsPath')); |
|
|
|
@ -48,6 +51,11 @@ class AssetBundleTest extends \yiiunit\TestCase
|
|
|
|
|
closedir($handle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function tearDown() |
|
|
|
|
{ |
|
|
|
|
rmdir(Yii::getAlias('@testReadOnlyAssetPath')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns View with configured AssetManager. |
|
|
|
|
* |
|
|
|
@ -173,6 +181,15 @@ class AssetBundleTest extends \yiiunit\TestCase
|
|
|
|
|
$this->assertTrue(is_dir($bundle->basePath)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testBasePathIsWritableOnPublish() |
|
|
|
|
{ |
|
|
|
|
$view = $this->getView(['basePath' => '@testReadOnlyAssetPath']); |
|
|
|
|
$bundle = new TestSourceAsset(); |
|
|
|
|
|
|
|
|
|
$this->setExpectedException('yii\base\InvalidConfigException', 'The directory is not writable by the Web process'); |
|
|
|
|
$bundle->publish($view->getAssetManager()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param View $view |
|
|
|
|
* @return AssetBundle |
|
|
|
|