|
5 | 5 | use Doctrine\DBAL\Connection; |
6 | 6 | use Doctrine\DBAL\Driver\PDOMySql\Driver; |
7 | 7 | use Doctrine\ORM\EntityManager; |
8 | | -use ErrorHeroModule\Listener\Mvc; |
9 | 8 | use ErrorHeroModule\Module; |
10 | 9 | use Kahlan\Plugin\Double; |
11 | 10 | use Zend\EventManager\EventManagerInterface; |
12 | 11 | use Zend\ModuleManager\Listener\ConfigListener; |
13 | 12 | use Zend\ModuleManager\ModuleEvent; |
14 | 13 | use Zend\ModuleManager\ModuleManager; |
15 | | -use Zend\Mvc\Application; |
16 | | -use Zend\Mvc\MvcEvent; |
17 | 14 | use Zend\ServiceManager\ServiceLocatorInterface; |
18 | 15 |
|
19 | 16 | describe('Module', function () { |
|
161 | 158 |
|
162 | 159 | }); |
163 | 160 |
|
164 | | - describe('->onBootstrap()', function () { |
165 | | - |
166 | | - it('pull Mvc Listener and use it to attach with EventManager', function () { |
167 | | - |
168 | | - $application = Double::instance(['extends' => Application::class, 'methods' => '__construct']); |
169 | | - $mvcListener = Double::instance(['extends' => Mvc::class, 'methods' => '__construct']); |
170 | | - $serviceManager = Double::instance(['implements' => ServiceLocatorInterface::class]); |
171 | | - $eventManager = Double::instance(['implements' => EventManagerInterface::class]); |
172 | | - $mvcEvent = Double::instance(['extends' => MvcEvent::class]); |
173 | | - |
174 | | - expect($mvcListener)->toReceive('attach')->with($eventManager); |
175 | | - |
176 | | - allow($application)->toReceive('getServiceManager')->andReturn($serviceManager); |
177 | | - allow($application)->toReceive('getEventManager')->andReturn($eventManager); |
178 | | - allow($serviceManager)->toReceive('get')->with(Mvc::class)->andReturn($mvcListener); |
179 | | - allow($mvcEvent)->toReceive('getApplication')->andReturn($application); |
180 | | - |
181 | | - $this->module->onBootstrap($mvcEvent); |
182 | | - |
183 | | - }); |
184 | | - |
185 | | - }); |
186 | | - |
187 | 161 | }); |
0 commit comments