File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 3131use Hyperf \Serializer \SimpleNormalizer ;
3232use Hyperf \Server \Event ;
3333use Hyperf \Server \Server ;
34+ use Hyperf \Server \ServerFactory ;
3435use Hyperf \Support \Filesystem \Filesystem ;
3536use Hyperf \Testing \Client ;
3637use HyperfTest \Testing \Stub \Exception \Handler \FooExceptionHandler ;
3738use HyperfTest \Testing \Stub \FooController ;
3839use Mockery ;
3940use PHPUnit \Framework \TestCase ;
41+ use Psr \EventDispatcher \EventDispatcherInterface ;
4042
4143/**
4244 * @internal
@@ -159,6 +161,14 @@ public function getContainer()
159161 return new CoreMiddleware (...array_values ($ args ));
160162 });
161163 $ container ->shouldReceive ('get ' )->with (Waiter::class)->andReturn (new Waiter ());
164+ $ dispatcher = Mockery::mock (EventDispatcherInterface::class);
165+ $ dispatcher ->shouldReceive ('dispatch ' )->shouldReceive ('dispatch ' )->andReturn (true );
166+ $ container ->shouldReceive ('has ' )->with (EventDispatcherInterface::class)->andReturn (true );
167+ $ container ->shouldReceive ('get ' )->with (EventDispatcherInterface::class)->andReturn ($ dispatcher );
168+ $ container ->shouldReceive ('get ' )->with (ServerFactory::class)->andReturn (
169+ Mockery::mock (ServerFactory::class)->shouldReceive ('getConfig ' )->andReturn (null )->getMock ()
170+ );
171+
162172 ApplicationContext::setContainer ($ container );
163173
164174 Router::init ($ factory );
You can’t perform that action at this time.
0 commit comments