getMockBuilder(Response::class) ->getMock(); $app = $this->getApp(); $this->setExpects($app, 'make', [Response::class], $response); $app->expects($this->exactly(3)) ->method('instance') ->withConsecutive( [Response::class, $response], [SymfonyResponse::class, $response], ['response', $response] ); $serviceProvider = new ResponseServiceProvider($app); $serviceProvider->register(); } }