1 | <?php |
||
14 | class HelperPassTest extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | public function testTagging() |
||
17 | { |
||
18 | $definitionObserver = $this->prophesize('\Symfony\Component\DependencyInjection\Definition'); |
||
19 | $definitionObserver->addMethodCall( |
||
20 | "addHelper", |
||
21 | Argument::allOf( |
||
22 | Argument::containing('test'), |
||
23 | Argument::containing(new Reference('handlebars.helper.test')) |
||
24 | ) |
||
25 | )->shouldBeCalled(); |
||
26 | $containerObserver = $this->prophesize('\Symfony\Component\DependencyInjection\ContainerBuilder'); |
||
27 | $containerObserver->has('handlebars.helper')->willReturn(true)->shouldBeCalled(); |
||
28 | $containerObserver->findDefinition('handlebars.helper')->willReturn($definitionObserver->reveal())->shouldBeCalled(); |
||
29 | |||
30 | $taggedServices = [ |
||
31 | 'handlebars.helper.test' => [ |
||
32 | ['id' => 'test'] |
||
33 | ] |
||
34 | ]; |
||
35 | $containerObserver->findTaggedServiceIds('handlebars.helper')->willReturn($taggedServices)->shouldBeCalled(); |
||
36 | |||
37 | $helperPass = new HelperPass(); |
||
38 | $helperPass->process($containerObserver->reveal()); |
||
39 | } |
||
40 | |||
41 | public function testDisabled() |
||
42 | { |
||
43 | $containerObserver = $this->prophesize('\Symfony\Component\DependencyInjection\ContainerBuilder'); |
||
44 | $containerObserver->has('handlebars.helper')->willReturn(false)->shouldBeCalled(); |
||
45 | |||
46 | $helperPass = new HelperPass(); |
||
47 | $helperPass->process($containerObserver->reveal()); |
||
48 | } |
||
49 | } |
||
50 |