mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 23:09:10 +08:00
Method "yii\console\controllers\AssetController::buildTarget()" has been fixed to compose input file name correctly.
This commit is contained in:
@@ -114,7 +114,8 @@ class AssetControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected function createBundleConfig()
|
protected function createBundleConfig()
|
||||||
{
|
{
|
||||||
$baseUrl = '/test';
|
$baseUrl = '';
|
||||||
|
//$baseUrl = '/test';
|
||||||
$bundles = array(
|
$bundles = array(
|
||||||
'app' => array(
|
'app' => array(
|
||||||
'basePath' => $this->testFilePath,
|
'basePath' => $this->testFilePath,
|
||||||
@@ -155,6 +156,19 @@ class AssetControllerTest extends TestCase
|
|||||||
return (file_put_contents($fileName, $content) > 0);
|
return (file_put_contents($fileName, $content) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates test asset file.
|
||||||
|
* @param string $fileRelativeName file name relative to [[testFilePath]]
|
||||||
|
* @param string $content file content
|
||||||
|
* @return boolean success.
|
||||||
|
*/
|
||||||
|
protected function createTestAssetFile($fileRelativeName, $content)
|
||||||
|
{
|
||||||
|
$fileFullName = $this->testFilePath.DIRECTORY_SEPARATOR.$fileRelativeName;
|
||||||
|
$this->createDir(dirname($fileFullName));
|
||||||
|
return (file_put_contents($fileFullName, $content) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Tests :
|
// Tests :
|
||||||
|
|
||||||
public function testActionTemplate()
|
public function testActionTemplate()
|
||||||
@@ -166,6 +180,20 @@ class AssetControllerTest extends TestCase
|
|||||||
|
|
||||||
public function testActionCompress()
|
public function testActionCompress()
|
||||||
{
|
{
|
||||||
|
$this->createTestAssetFile(
|
||||||
|
'css/test.css',
|
||||||
|
'body {
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 60px;
|
||||||
|
}'
|
||||||
|
);
|
||||||
|
$this->createTestAssetFile(
|
||||||
|
'js/test.js',
|
||||||
|
"function() {
|
||||||
|
alert('Test message');
|
||||||
|
}"
|
||||||
|
);
|
||||||
|
|
||||||
$configFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'config.php';
|
$configFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'config.php';
|
||||||
$this->createCompressConfigFile($configFile);
|
$this->createCompressConfigFile($configFile);
|
||||||
$bundleFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'bundle.php';
|
$bundleFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'bundle.php';
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class AssetController extends Controller
|
|||||||
foreach ($target->depends as $name) {
|
foreach ($target->depends as $name) {
|
||||||
if (isset($bundles[$name])) {
|
if (isset($bundles[$name])) {
|
||||||
foreach ($bundles[$name]->$type as $file) {
|
foreach ($bundles[$name]->$type as $file) {
|
||||||
$inputFiles[] = $bundles[$name]->basePath . '/' . $file;
|
$inputFiles[] = $bundles[$name]->basePath . $file;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Unknown bundle: $name");
|
throw new Exception("Unknown bundle: $name");
|
||||||
|
|||||||
Reference in New Issue
Block a user