@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | throw new InvalidArgumentException('schema must be given as array or JSON string'); |
30 | 30 | } |
31 | 31 | $this->jsonFile = $data; |
32 | - $this->allowNullValues = (bool) $allowNullValues; |
|
32 | + $this->allowNullValues = (bool)$allowNullValues; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getHttpSchema() |
@@ -121,6 +121,6 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setAllowNullValues($value) |
123 | 123 | { |
124 | - $this->allowNullValues = (bool) $value; |
|
124 | + $this->allowNullValues = (bool)$value; |
|
125 | 125 | } |
126 | 126 | } |
@@ -119,6 +119,9 @@ |
||
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param integer $code |
|
124 | + */ |
|
122 | 125 | public function assertResponseCode($code) |
123 | 126 | { |
124 | 127 | $this->statusExpected = $code; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Preparing Parameters |
164 | 164 | $paramInQuery = null; |
165 | 165 | if (!empty($this->query)) { |
166 | - $paramInQuery = '?' . http_build_query($this->query); |
|
166 | + $paramInQuery = '?'.http_build_query($this->query); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Preparing Header |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | $statusReturned = null; |
189 | 189 | // Run the request |
190 | - $response = $this->handleRequest($pathName . $paramInQuery, $header); |
|
190 | + $response = $this->handleRequest($pathName.$paramInQuery, $header); |
|
191 | 191 | |
192 | 192 | // Get the response |
193 | 193 | $responseHeader = $response->getHeaders(); |
194 | - $responseBody = json_decode((string) $response->getBody(), true); |
|
194 | + $responseBody = json_decode((string)$response->getBody(), true); |
|
195 | 195 | $statusReturned = $response->getStatusCode(); |
196 | 196 | |
197 | 197 | // Assert results |
@@ -8,5 +8,5 @@ |
||
8 | 8 | |
9 | 9 | abstract class ApiTestCase extends TestCase |
10 | 10 | { |
11 | - use AssertRequestAgainstSchema; |
|
11 | + use AssertRequestAgainstSchema; |
|
12 | 12 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | if (!isset($this->structure['content'])) { |
26 | 26 | if (!empty($body)) { |
27 | - throw new NotMatchedException("Expected empty body for " . $this->name); |
|
27 | + throw new NotMatchedException("Expected empty body for ".$this->name); |
|
28 | 28 | } |
29 | 29 | return true; |
30 | 30 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | // Make the request |
37 | 37 | $request = new Request( |
38 | 38 | $this->method, |
39 | - $this->schema->getServerUrl() . $path, |
|
39 | + $this->schema->getServerUrl().$path, |
|
40 | 40 | $headers, |
41 | 41 | json_encode($this->requestBody) |
42 | 42 | ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | if (!isset($this->structure['schema'])) { |
26 | 26 | if (!empty($body)) { |
27 | - throw new NotMatchedException("Expected empty body for " . $this->name); |
|
27 | + throw new NotMatchedException("Expected empty body for ".$this->name); |
|
28 | 28 | } |
29 | 29 | return true; |
30 | 30 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | $this->body = $body; |
15 | 15 | if (!empty($body)) { |
16 | - $message = $message . " ->\n" . json_encode($body, JSON_PRETTY_PRINT) . "\n"; |
|
16 | + $message = $message." ->\n".json_encode($body, JSON_PRETTY_PRINT)."\n"; |
|
17 | 17 | } |
18 | 18 | parent::__construct($message, $code, $previous); |
19 | 19 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $method = strtolower($method); |
80 | 80 | |
81 | - $path = preg_replace('~^' . $this->getBasePath() . '~', '', $path); |
|
81 | + $path = preg_replace('~^'.$this->getBasePath().'~', '', $path); |
|
82 | 82 | |
83 | 83 | $uri = new Uri($path); |
84 | 84 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | - $pathItemPattern = '~^' . preg_replace('~{(.*?)}~', '(?<\1>[^/]+)', $pathItem) . '$~'; |
|
99 | + $pathItemPattern = '~^'.preg_replace('~{(.*?)}~', '(?<\1>[^/]+)', $pathItem).'$~'; |
|
100 | 100 | |
101 | 101 | $matches = []; |
102 | 102 | if (preg_match($pathItemPattern, $uri->getPath(), $matches)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | - throw new PathNotFoundException('Path "' . $path . '" not found'); |
|
125 | + throw new PathNotFoundException('Path "'.$path.'" not found'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function validate($format, $value) |
22 | 22 | { |
23 | 23 | // full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21 |
24 | - if ($format === 'date' ) { |
|
24 | + if ($format === 'date') { |
|
25 | 25 | $match = preg_match('/^[\d]{4}-[\d]{2}-[\d]{2}$/', $value); |
26 | 26 | return $match !== false && $match !== 0; |
27 | 27 | } |