From 82b2f795b8bae2df8cd687b25f3d09356f609990 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 17 Sep 2014 20:07:35 +0200 Subject: [PATCH] test case for #5084 --- tests/unit/framework/web/AssetBundleTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/unit/framework/web/AssetBundleTest.php b/tests/unit/framework/web/AssetBundleTest.php index c44635cf6ae..73faa9faf75 100644 --- a/tests/unit/framework/web/AssetBundleTest.php +++ b/tests/unit/framework/web/AssetBundleTest.php @@ -186,6 +186,24 @@ public function testCircularDependency() $this->setExpectedException('yii\\base\\InvalidConfigException'); TestAssetCircleA::register($this->getView()); } + + public function testDuplicateAssetFile() + { + $view = $this->getView(); + + $this->assertEmpty($view->assetBundles); + TestSimpleAsset::register($view); + $this->assertEquals(1, count($view->assetBundles)); + $this->assertArrayHasKey('yiiunit\\framework\\web\\TestSimpleAsset', $view->assetBundles); + $this->assertTrue($view->assetBundles['yiiunit\\framework\\web\\TestSimpleAsset'] instanceof AssetBundle); + // register TestJqueryAsset which also has the jquery.js + TestJqueryAsset::register($view); + + $expected = <<4 +EOF; + $this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php')); + } } class TestSimpleAsset extends AssetBundle