/** * Asserts response headers match with the media types defined. * * @param string[] $headers * @param SchemaManager $schemaManager * @param string $path percent-encoded path used on the request. * @param string $httpMethod * @param int $httpCode * @param string $message */ public function assertResponseHeadersMatch(array $headers, SchemaManager $schemaManager, $path, $httpMethod, $httpCode, $message = '') { if (!$schemaManager->findPathInTemplates($path, $template, $params)) { throw new \RuntimeException('Request URI does not match with any swagger path definition'); } $constraint = new ResponseHeadersConstraint($schemaManager, $template, $httpMethod, $httpCode); Assert::assertThat($headers, $constraint, $message); }
/** * @dataProvider validPathsProvider * * @param string $requestPath * @param string $expectedTemplate * @param array $expectedParameters */ public function testFindPathInTemplatesValid($requestPath, $expectedTemplate, array $expectedParameters) { self::assertTrue($this->schemaManager->findPathInTemplates($requestPath, $path, $parameters)); self::assertEquals($expectedTemplate, $path); self::assertEquals($expectedParameters, $parameters); }