Skip to content

Commit

Permalink
test case for yiisoft#5084
Browse files Browse the repository at this point in the history
  • Loading branch information
cebe committed Sep 17, 2014
1 parent a75e045 commit 82b2f79
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/framework/web/AssetBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<<EOF
123<script src="/js/jquery.js"></script>4
EOF;
$this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
}
}

class TestSimpleAsset extends AssetBundle
Expand Down

0 comments on commit 82b2f79

Please sign in to comment.