From b3c6d70cda73444473bc87222553089adf75f8f7 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Tue, 6 Jan 2015 17:54:20 +0200 Subject: [PATCH] Unit test for `yii\console\controllers\AssetController` advanced --- .../console/controllers/AssetControllerTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/framework/console/controllers/AssetControllerTest.php b/tests/unit/framework/console/controllers/AssetControllerTest.php index a4ce9904306..a9fc69505c5 100644 --- a/tests/unit/framework/console/controllers/AssetControllerTest.php +++ b/tests/unit/framework/console/controllers/AssetControllerTest.php @@ -285,7 +285,15 @@ public function testActionCompress() // Then : $this->assertTrue(file_exists($bundleFile), 'Unable to create output bundle file!'); - $this->assertTrue(is_array(require($bundleFile)), 'Output bundle file has incorrect format!'); + $compressedBundleConfig = require($bundleFile); + $this->assertTrue(is_array($compressedBundleConfig), 'Output bundle file has incorrect format!'); + $this->assertCount(2, $compressedBundleConfig, 'Output bundle config contains wrong bundle count!'); + + $this->assertArrayHasKey($assetBundleClassName, $compressedBundleConfig, 'Source bundle is lost!'); + $compressedAssetBundleConfig = $compressedBundleConfig[$assetBundleClassName]; + $this->assertEmpty($compressedAssetBundleConfig['css'], 'Compressed bundle css is not empty!'); + $this->assertEmpty($compressedAssetBundleConfig['js'], 'Compressed bundle js is not empty!'); + $this->assertNotEmpty($compressedAssetBundleConfig['depends'], 'Compressed bundle dependency is invalid!'); $compressedCssFileName = $this->testAssetsBasePath . DIRECTORY_SEPARATOR . 'all.css'; $this->assertTrue(file_exists($compressedCssFileName), 'Unable to compress CSS files!');