validator->validate($operation, $response); } public function setUp(): void { parent::setUp(); $this->initDatabase(); $openApiDefinition = $this->app->get('path.resources.api') . '/openapi.yml'; $this->validator = (new OpenApiValidatorBuilder()) ->fromYamlFile($openApiDefinition) ->getResponseValidator(); /** @var UrlGeneratorInterface|MockObject $url */ $url = $this->getMockForAbstractClass(UrlGeneratorInterface::class); $url->expects($this->any()) ->method('to') ->willReturnCallback(function (string $path, array $params): string { $query = http_build_query($params); return $path . ($query ? '?' . $query : ''); }); $this->app->instance('http.urlGenerator', $url); } }