Skip to content

Commit

Permalink
Unit test for yii\console\controllers\AssetController advanced
Browse files Browse the repository at this point in the history
  • Loading branch information
klimov-paul committed Jan 6, 2015
1 parent 9b9b361 commit b3c6d70
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand Down

0 comments on commit b3c6d70

Please sign in to comment.