From 78ecdc05c34f706a4eab3ff09161a3a79189cdf6 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 21 Sep 2015 21:07:15 -0400 Subject: Add plugin hooks for assets --- tests/units/Helper/HookHelperTest.php | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'tests/units') diff --git a/tests/units/Helper/HookHelperTest.php b/tests/units/Helper/HookHelperTest.php index 6661c90b..7745c674 100644 --- a/tests/units/Helper/HookHelperTest.php +++ b/tests/units/Helper/HookHelperTest.php @@ -37,4 +37,38 @@ class HookHelperTest extends Base $h->attach('test', 'tpl2'); $this->assertEquals('tpl1_contenttpl2_content', $h->render('test')); } -} \ No newline at end of file + + public function testAssetHooks() + { + $this->container['helper']->asset = $this + ->getMockBuilder('\Helper\Asset') + ->setConstructorArgs(array($this->container)) + ->setMethods(array('css', 'js')) + ->getMock(); + + $this->container['helper'] + ->asset + ->expects($this->at(0)) + ->method('css') + ->with( + $this->equalTo('skin.css') + ) + ->will($this->returnValue('')); + + $this->container['helper'] + ->asset + ->expects($this->at(1)) + ->method('js') + ->with( + $this->equalTo('skin.js') + ) + ->will($this->returnValue('')); + + $h = new Hook($this->container); + $h->attach('test1', 'skin.css'); + $h->attach('test2', 'skin.js'); + + $this->assertContains('', $h->asset('css', 'test1')); + $this->assertContains('', $h->asset('js', 'test2')); + } +} -- cgit v1.2.3