summaryrefslogtreecommitdiff
path: root/tests/units/Helper/HookHelperTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-20 15:53:28 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-20 15:53:28 -0400
commit2021dccc5a444f60c5ba1673d94b39999912cd26 (patch)
tree5d805496f001456baa83c0776a32bdb24511511b /tests/units/Helper/HookHelperTest.php
parenta0124b45f9dab8a0f7d4879d4ea147b414b25bf2 (diff)
Move subtask forecast to a plugin
Plugin repo: https://github.com/kanboard/plugin-subtask-forecast
Diffstat (limited to 'tests/units/Helper/HookHelperTest.php')
-rw-r--r--tests/units/Helper/HookHelperTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/units/Helper/HookHelperTest.php b/tests/units/Helper/HookHelperTest.php
new file mode 100644
index 00000000..6661c90b
--- /dev/null
+++ b/tests/units/Helper/HookHelperTest.php
@@ -0,0 +1,40 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Helper\Hook;
+
+class HookHelperTest extends Base
+{
+ public function testMultipleHooks()
+ {
+ $this->container['template'] = $this
+ ->getMockBuilder('\Core\Template')
+ ->setConstructorArgs(array($this->container))
+ ->setMethods(array('render'))
+ ->getMock();
+
+ $this->container['template']
+ ->expects($this->at(0))
+ ->method('render')
+ ->with(
+ $this->equalTo('tpl1'),
+ $this->equalTo(array())
+ )
+ ->will($this->returnValue('tpl1_content'));
+
+ $this->container['template']
+ ->expects($this->at(1))
+ ->method('render')
+ ->with(
+ $this->equalTo('tpl2'),
+ $this->equalTo(array())
+ )
+ ->will($this->returnValue('tpl2_content'));
+
+ $h = new Hook($this->container);
+ $h->attach('test', 'tpl1');
+ $h->attach('test', 'tpl2');
+ $this->assertEquals('tpl1_contenttpl2_content', $h->render('test'));
+ }
+} \ No newline at end of file