File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 18
18
use Hyperf \Framework \Logger \StdoutLogger ;
19
19
use Hyperf \RpcMultiplex \Socket ;
20
20
use Hyperf \RpcMultiplex \SocketFactory ;
21
+ use Hyperf \Server \ServerFactory ;
21
22
use Mockery ;
22
23
use Multiplex \Contract \IdGeneratorInterface ;
23
24
use Multiplex \Contract \PackerInterface ;
24
25
use Multiplex \Contract \SerializerInterface ;
25
26
use Multiplex \IdGenerator ;
26
27
use Multiplex \Packer ;
27
28
use Multiplex \Serializer \StringSerializer ;
29
+ use Psr \EventDispatcher \EventDispatcherInterface ;
28
30
29
31
class ContainerStub
30
32
{
@@ -44,6 +46,16 @@ public static function mockContainer(): Container
44
46
$ container ->shouldReceive ('make ' )->with (SocketFactory::class, Mockery::any ())->andReturnUsing (function ($ _ , $ args ) use ($ container ) {
45
47
return new SocketFactory ($ container , ...array_values ($ args ));
46
48
});
49
+
50
+ $ dispatcher = Mockery::mock (EventDispatcherInterface::class);
51
+ $ dispatcher ->shouldReceive ('dispatch ' )->andReturn (true );
52
+ $ container ->shouldReceive ('has ' )->with (EventDispatcherInterface::class)->andReturn (true );
53
+ $ container ->shouldReceive ('get ' )->with (EventDispatcherInterface::class)->andReturn ($ dispatcher );
54
+
55
+ $ serverFactory = Mockery::mock (ServerFactory::class);
56
+ $ serverFactory ->shouldReceive ('getConfig ' )->andReturn (null );
57
+ $ container ->shouldReceive ('get ' )->with (ServerFactory::class)->andReturn ($ serverFactory );
58
+
47
59
return $ container ;
48
60
}
49
61
}
You can’t perform that action at this time.
0 commit comments