@@ -31,7 +31,7 @@ class ContainerStub
3131 public static function mockContainer ()
3232 {
3333 $ container = Mockery::mock (Container::class);
34- $ container ->shouldReceive ('get ' )->once ()-> with (ConfigInterface::class)->andReturn (new Config ([
34+ $ container ->shouldReceive ('get ' )->with (ConfigInterface::class)->andReturn (new Config ([
3535 'redis ' => [
3636 'default ' => [
3737 'host ' => 'localhost ' ,
@@ -49,20 +49,21 @@ public static function mockContainer()
4949 ],
5050 ],
5151 ]));
52- $ pool = new RedisPool ($ container , 'default ' );
5352 $ frequency = Mockery::mock (LowFrequencyInterface::class);
5453 $ frequency ->shouldReceive ('isLowFrequency ' )->andReturn (false );
5554 $ container ->shouldReceive ('make ' )->with (Frequency::class, Mockery::any ())->andReturn ($ frequency );
56- $ container ->shouldReceive ('make ' )->with (RedisPool::class, ['name ' => 'default ' ])->andReturn ($ pool );
55+ $ container ->shouldReceive ('make ' )->with (RedisPool::class, ['name ' => 'default ' ])->andReturnUsing (function () use ($ container ) {
56+ return new RedisPool ($ container , 'default ' );
57+ });
5758 $ container ->shouldReceive ('make ' )->with (Channel::class, ['size ' => 30 ])->andReturn (new Channel (30 ));
5859 $ container ->shouldReceive ('make ' )->with (PoolOption::class, Mockery::any ())->andReturnUsing (function ($ class , $ args ) {
5960 return new PoolOption (...array_values ($ args ));
6061 });
6162 $ container ->shouldReceive ('has ' )->with (\Redis::class)->andReturn (true );
62- $ container ->shouldReceive ('get ' )->with (\Redis::class)->andReturn ( value (function () use ($ container ) {
63+ $ container ->shouldReceive ('get ' )->with (\Redis::class)->andReturnUsing (function () use ($ container ) {
6364 $ factory = new PoolFactory ($ container );
6465 return new Redis ($ factory );
65- })) ;
66+ });
6667 $ container ->shouldReceive ('has ' )->with (StdoutLoggerInterface::class)->andReturn (true );
6768 $ container ->shouldReceive ('get ' )->with (StdoutLoggerInterface::class)->andReturn (value (function () {
6869 return Mockery::mock (StdoutLoggerInterface::class);
0 commit comments