summaryrefslogtreecommitdiff
path: root/tests/units/Helper/HookHelperTest.php
blob: 6661c90bcffe37c9e7ed0c0c1c5e61c088f86fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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'));
    }
}