/** * @param array $response * @param string $httpMethod * @param string $url * @param bool $onlyRequired * @return bool */ public static function responseHasSwaggerKeys($response, $httpMethod, $url, $onlyRequired = true) { $responseToCompare = new Response($response); $annotation = new Annotation($httpMethod, $url, self::$analyzedData, $onlyRequired); $pick = new PickResponseAndAnnotation($responseToCompare, $annotation); $compare = new CompareResponseAndAnnotation($pick); return $compare->execute(); }
/** * @test */ public function collectionCase() { $expected = new Expected(); $expected->push('collection', new Expected('A')); $actual = new Expected(); $actual->push('collection', new Actual('A')); $picker = $this->createPickerMock($expected, $actual); $subject = new CompareResponseAndAnnotation($picker); $this->assertTrue($subject->execute()); }
/** * @test * @expectedException \SwaggerAssert\Exception\CompareException */ public function tooManyExpectedKey() { $expected = new Expected(); $expected->push('a'); $expected->push('b'); $expected->push('c'); $actual = new Actual(); $actual->push('a'); $actual->push('b'); $picker = $this->createPickerMock($expected, $actual); $subject = new CompareResponseAndAnnotation($picker); $subject->execute(); }