failing test for asset bundle publishing empty directories

This commit is contained in:
quantum
2015-12-29 01:14:04 +10:00
committed by Carsten Brandt
parent 18bc835243
commit 583a2bcb9f

View File

@ -134,6 +134,31 @@ class AssetBundleTest extends \yiiunit\TestCase
$this->assertTrue(rmdir($bundle->basePath)); $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 * @param View $view
* @return AssetBundle * @return AssetBundle