1 | <?php |
||
12 | class ModuleTest extends TestCase |
||
13 | { |
||
14 | public function testOnBootstrapAllEnabled() |
||
15 | { |
||
16 | $event = $this->prophesize(MvcEvent::class); |
||
17 | $app = $this->prophesize(Application::class); |
||
18 | $container = $this->prophesize(ContainerInterface::class); |
||
19 | $eventManager = $this->prophesize(EventManagerInterface::class); |
||
20 | $options = $this->prophesize(OptionsInterface::class); |
||
21 | |||
22 | $linkHandler = $this->prophesize(Listener\LinkHandlerInterface::class); |
||
23 | $stylesheetHandler = $this->prophesize(Listener\LinkHandlerInterface::class); |
||
24 | $scriptHandler = $this->prophesize(Listener\LinkHandlerInterface::class); |
||
25 | |||
26 | $event->getApplication()->willReturn($app->reveal()); |
||
27 | $app->getEventManager()->willReturn($eventManager->reveal()); |
||
28 | $app->getServiceManager()->willReturn($container->reveal()); |
||
29 | |||
30 | $container->get(OptionsInterface::class)->willReturn($options->reveal()); |
||
31 | $container->get(Listener\LinkHandler::class)->willReturn($linkHandler->reveal()); |
||
32 | $container->get(Listener\StylesheetHandler::class)->willReturn($stylesheetHandler->reveal()); |
||
33 | $container->get(Listener\ScriptHandler::class)->willReturn($scriptHandler->reveal()); |
||
34 | |||
35 | $eventManager->attach(MvcEvent::EVENT_FINISH, $linkHandler->reveal()) |
||
36 | ->shouldBeCalled(); |
||
37 | |||
38 | $options->isStylesheetEnabled()->willReturn(true); |
||
39 | $options->isScriptEnabled()->willReturn(true); |
||
40 | |||
41 | $eventManager->attach(MvcEvent::EVENT_FINISH, $stylesheetHandler->reveal()) |
||
42 | ->shouldBeCalled(); |
||
43 | |||
44 | $eventManager->attach(MvcEvent::EVENT_FINISH, $scriptHandler->reveal()) |
||
45 | ->shouldBeCalled(); |
||
46 | |||
47 | $module = new Module(); |
||
48 | $module->onBootstrap($event->reveal()); |
||
49 | } |
||
50 | |||
51 | public function testOnBootstrapWithNoMvcEvent() |
||
52 | { |
||
53 | $event = $this->prophesize(EventInterface::class); |
||
54 | |||
55 | $event->getName()->shouldNotBeCalled(); |
||
56 | |||
57 | $module = new Module(); |
||
58 | $module->onBootstrap($event->reveal()); |
||
59 | } |
||
60 | |||
61 | public function testGetConfig() |
||
62 | { |
||
63 | $module = new Module(); |
||
64 | $result = $module->getConfig(); |
||
65 | |||
66 | $this->assertInternalType('array', $result); |
||
67 | } |
||
68 | } |
||
69 |