| @@ 56-69 (lines=14) @@ | ||
| 53 | /** |
|
| 54 | * @test |
|
| 55 | */ |
|
| 56 | public function parameterValidationErrorWillContainSpecificationPointer() |
|
| 57 | { |
|
| 58 | try { |
|
| 59 | $this->get('/v2/pet/findByStatus', ['status' => 'bogus']); |
|
| 60 | } catch (ApiResponseErrorException $e) { |
|
| 61 | $error = Hal::fromJson($e->getJson(), 10); |
|
| 62 | $resource = $error->getFirstResource('errors'); |
|
| 63 | $specLink = 'http://petstore.swagger.io/swagger/petstore.yml#/paths/~1pet~1findByStatus/get/parameters/0'; |
|
| 64 | $this->assertSame($specLink, $resource->getUri()); |
|
| 65 | ||
| 66 | return; |
|
| 67 | } |
|
| 68 | $this->fail("Expected exception"); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @test |
|
| @@ 74-90 (lines=17) @@ | ||
| 71 | /** |
|
| 72 | * @test |
|
| 73 | */ |
|
| 74 | public function parameterValidationErrorWillContainSpecificationPointerForBodyParameter() |
|
| 75 | { |
|
| 76 | $this->markTestIncomplete('Not working with JSON-Schema version'); |
|
| 77 | ||
| 78 | $url = 'http://petstore.swagger.io/swagger/petstore.yml'; |
|
| 79 | try { |
|
| 80 | $this->post('/v2/store/order', []); |
|
| 81 | } catch (ApiResponseErrorException $e) { |
|
| 82 | $error = Hal::fromJson($e->getJson(), 10); |
|
| 83 | $resource = $error->getFirstResource('errors'); |
|
| 84 | $specLink = $url . '#/paths/~1pet~1findByStatus/get/parameters/0/body/properties/quantity'; |
|
| 85 | $this->assertSame($specLink, $resource->getUri()); |
|
| 86 | ||
| 87 | return; |
|
| 88 | } |
|
| 89 | $this->fail("Expected exception"); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @test |
|
| @@ 95-108 (lines=14) @@ | ||
| 92 | /** |
|
| 93 | * @test |
|
| 94 | */ |
|
| 95 | public function parameterValidationErrorWillContainSchemaPointer() |
|
| 96 | { |
|
| 97 | try { |
|
| 98 | $this->get('/v2/pet/findByStatus', ['status' => 'bogus']); |
|
| 99 | } catch (ApiResponseErrorException $e) { |
|
| 100 | $error = Hal::fromJson($e->getJson(), 10); |
|
| 101 | $resource = $error->getFirstResource('errors'); |
|
| 102 | $data = $resource->getData(); |
|
| 103 | $this->assertSame('/paths/~1pet~1findByStatus/get/x-request-schema/properties/status', $data['path']); |
|
| 104 | ||
| 105 | return; |
|
| 106 | } |
|
| 107 | $this->fail("Expected exception"); |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * @test |
|