Skip to content

Commit 2ab3f0e

Browse files
Support http request lifecycle events. (#5715)
Co-authored-by: Deeka Wong <[email protected]> Co-authored-by: 李铭昕 <[email protected]>
1 parent acd0ce4 commit 2ab3f0e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/ClientTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
use Hyperf\Serializer\SimpleNormalizer;
3232
use Hyperf\Server\Event;
3333
use Hyperf\Server\Server;
34+
use Hyperf\Server\ServerFactory;
3435
use Hyperf\Support\Filesystem\Filesystem;
3536
use Hyperf\Testing\Client;
3637
use HyperfTest\Testing\Stub\Exception\Handler\FooExceptionHandler;
3738
use HyperfTest\Testing\Stub\FooController;
3839
use Mockery;
3940
use 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);

0 commit comments

Comments
 (0)