createMock(DiactorosFactory::class); /** @var MockObject|Request $request */ $request = $this->createMock(Request::class); /** @var MockObject|Response $response */ $response = $this->createMock(Response::class); /** @var MockObject|RequestInterface $psr7request */ $psr7request = $this->createMock(Request::class); /** @var MockObject|ResponseInterface $psr7response */ $psr7response = $this->createMock(Response::class); $app = $this->getApp(['make', 'instance', 'get', 'bind']); $this->setExpects($app, 'make', [DiactorosFactory::class], $psr7Factory); $app->expects($this->atLeastOnce()) ->method('get') ->withConsecutive(['request'], ['response']) ->willReturnOnConsecutiveCalls($request, $response); $app->expects($this->atLeastOnce()) ->method('instance') ->withConsecutive( ['psr7.factory', $psr7Factory], ['psr7.request', $psr7request], ['psr7.response', $psr7response] ); $app->expects($this->atLeastOnce()) ->method('bind') ->withConsecutive( [RequestInterface::class, 'psr7.request'], [ResponseInterface::class, 'psr7.response'] ); $serviceProvider = new Psr7ServiceProvider($app); $serviceProvider->register(); } }