getApp(['make', 'instance', 'bind', 'get']); /** @var MockObject|Config $config */ $config = $this->getMockBuilder(Config::class)->getMock(); /** @var MockObject|UrlGeneratorInterface $urlGenerator */ $urlGenerator = $this->getMockForAbstractClass(UrlGeneratorInterface::class); /** @var MockObject|UrlGeneratorInterface $legacyUrlGenerator */ $legacyUrlGenerator = $this->getMockForAbstractClass(UrlGeneratorInterface::class); $config->expects($this->atLeastOnce()) ->method('get') ->with('rewrite_urls') ->willReturnOnConsecutiveCalls( true, false ); $this->setExpects($app, 'get', ['config'], $config, $this->atLeastOnce()); $app->expects($this->atLeastOnce()) ->method('make') ->withConsecutive( [UrlGenerator::class], [LegacyUrlGenerator::class] ) ->willReturnOnConsecutiveCalls( $urlGenerator, $legacyUrlGenerator ); $app->expects($this->atLeastOnce()) ->method('instance') ->withConsecutive( ['routing.urlGenerator', $urlGenerator], ['routing.urlGenerator', $legacyUrlGenerator] ); $this->setExpects( $app, 'bind', [UrlGeneratorInterface::class, 'routing.urlGenerator'], null, $this->atLeastOnce() ); $serviceProvider = new RoutingServiceProvider($app); $serviceProvider->register(); $serviceProvider->register(); } }