Commit 82b2f795 by Carsten Brandt

test case for #5084

parent a75e0450
...@@ -186,6 +186,24 @@ EOF; ...@@ -186,6 +186,24 @@ EOF;
$this->setExpectedException('yii\\base\\InvalidConfigException'); $this->setExpectedException('yii\\base\\InvalidConfigException');
TestAssetCircleA::register($this->getView()); 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 = <<<EOF
123<script src="/js/jquery.js"></script>4
EOF;
$this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
}
} }
class TestSimpleAsset extends AssetBundle class TestSimpleAsset extends AssetBundle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment