diff --git a/tests/unit/framework/console/controllers/AssetControllerTest.php b/tests/unit/framework/console/controllers/AssetControllerTest.php index 42eb320..b19b426 100644 --- a/tests/unit/framework/console/controllers/AssetControllerTest.php +++ b/tests/unit/framework/console/controllers/AssetControllerTest.php @@ -55,6 +55,7 @@ class AssetControllerTest extends TestCase { $module = $this->getMock('yii\\base\\Module', array('fake'), array('console')); $assetController = new AssetController('asset', $module); + $assetController->interactive = false; $assetController->jsCompressor = 'cp {from} {to}'; $assetController->cssCompressor = 'cp {from} {to}'; return $assetController; diff --git a/yii/console/controllers/AssetController.php b/yii/console/controllers/AssetController.php index aab489b..d90f767 100644 --- a/yii/console/controllers/AssetController.php +++ b/yii/console/controllers/AssetController.php @@ -322,6 +322,10 @@ EOD file_put_contents($tmpFile, $content); } + /** + * Creates template of configuration file for [[actionCompress]]. + * @param string $configFile output file name. + */ public function actionTemplate($configFile) { $template = <<confirm("File '{$configFile}' already exists. Do you wish to overwrite it?")) { + return; + } + } + $bytesWritten = file_put_contents($configFile, $template); + if ($bytesWritten<=0) { + echo "Error: unable to write file '{$configFile}'!\n\n"; + } else { + echo "Configuration file template created at '{$configFile}'.\n\n"; + } } }