Browse Source

Method "AssetController::adjustCssUrl()" has been complete.

tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
b6ec6085fe
  1. 2
      framework/yii/console/controllers/AssetController.php
  2. 12
      tests/unit/framework/console/controllers/AssetControllerTest.php

2
framework/yii/console/controllers/AssetController.php

@ -579,7 +579,7 @@ EOD
return str_replace($inputUrl, $outputUrl, $fullMatch); return str_replace($inputUrl, $outputUrl, $fullMatch);
}; };
$cssContent = preg_replace_callback('/[\w\-]:\s*url\("([^"]*)"\)+/is', $callback, $cssContent); $cssContent = preg_replace_callback('/url\(["\']?([^"]*)["\']?\)/is', $callback, $cssContent);
return $cssContent; return $cssContent;
} }

12
tests/unit/framework/console/controllers/AssetControllerTest.php

@ -263,22 +263,22 @@ class AssetControllerTest extends TestCase
{ {
return array( return array(
array( array(
'.published-same-dir-class {background-image: url("published_same_dir.png");}', '.published-same-dir-class {background-image: url(published_same_dir.png);}',
'/test/base/path/assets/input', '/test/base/path/assets/input',
'/test/base/path/assets/output', '/test/base/path/assets/output',
'.published-same-dir-class {background-image: url("../input/published_same_dir.png");}', '.published-same-dir-class {background-image: url(../input/published_same_dir.png);}',
), ),
array( array(
'.published-relative-dir-class {background-image: url("../img/published_relative_dir.png");}', '.published-relative-dir-class {background-image: url(../img/published_relative_dir.png);}',
'/test/base/path/assets/input', '/test/base/path/assets/input',
'/test/base/path/assets/output', '/test/base/path/assets/output',
'.published-relative-dir-class {background-image: url("../img/published_relative_dir.png");}', '.published-relative-dir-class {background-image: url(../img/published_relative_dir.png);}',
), ),
array( array(
'.static-same-dir-class {background-image: url("static_same_dir.png");}', '.static-same-dir-class {background-image: url(\'static_same_dir.png\');}',
'/test/base/path/css', '/test/base/path/css',
'/test/base/path/assets/output', '/test/base/path/assets/output',
'.static-same-dir-class {background-image: url("../../css/static_same_dir.png");}', '.static-same-dir-class {background-image: url(\'../../css/static_same_dir.png\');}',
), ),
array( array(
'.static-relative-dir-class {background-image: url("../img/static_relative_dir.png");}', '.static-relative-dir-class {background-image: url("../img/static_relative_dir.png");}',

Loading…
Cancel
Save