From 583a2bcb9fe7875420821d2202ed7dabc8320c6f Mon Sep 17 00:00:00 2001 From: quantum Date: Tue, 29 Dec 2015 01:14:04 +1000 Subject: [PATCH] failing test for asset bundle publishing empty directories --- tests/framework/web/AssetBundleTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/framework/web/AssetBundleTest.php b/tests/framework/web/AssetBundleTest.php index d2e927460c..54c59ed83c 100644 --- a/tests/framework/web/AssetBundleTest.php +++ b/tests/framework/web/AssetBundleTest.php @@ -134,6 +134,31 @@ class AssetBundleTest extends \yiiunit\TestCase $this->assertTrue(rmdir($bundle->basePath)); } + public function testSourcesPublish_publishOptions_Only() + { + $view = $this->getView(); + $am = $view->assetManager; + + $bundle = new TestSourceAsset([ + 'publishOptions' => [ + 'only' => [ + 'js/*' + ] + ], + ]); + $bundle->publish($am); + + $notNeededFilesDir = $bundle->basePath . DIRECTORY_SEPARATOR . 'css'; + $this->assertFileNotExists($notNeededFilesDir); + + foreach ($bundle->js as $filename) { + $publishedFile = $bundle->basePath . DIRECTORY_SEPARATOR . $filename; + $this->assertTrue(unlink($publishedFile)); + } + $this->assertTrue(rmdir($bundle->basePath . DIRECTORY_SEPARATOR . 'js')); + $this->assertTrue(rmdir($bundle->basePath)); + } + /** * @param View $view * @return AssetBundle