@@ 149-167 (lines=19) @@ | ||
146 | /** |
|
147 | * @test |
|
148 | */ |
|
149 | public function testPatchActionWhenEmployeeDoesNotExistReturns400() |
|
150 | { |
|
151 | $content = <<<JSON |
|
152 | { |
|
153 | "data": { |
|
154 | "type": "employee", |
|
155 | "id": 1000, |
|
156 | "attributes": { |
|
157 | "email_address": "[email protected]" |
|
158 | } |
|
159 | } |
|
160 | } |
|
161 | JSON; |
|
162 | $this->serverEnvironment('PATCH', 'localhost', '/api/v1/employees/1000'); |
|
163 | $response = $this->call('PATCH', 'http://localhost/api/v1/employees/1000', json_decode($content, true), [], [], []); |
|
164 | ||
165 | $this->assertEquals(400, $response->getStatusCode()); |
|
166 | $this->assertEquals('application/vnd.api+json', $response->headers->get('Content-type')); |
|
167 | } |
|
168 | ||
169 | /** |
|
170 | * @test |
|
@@ 172-206 (lines=35) @@ | ||
169 | /** |
|
170 | * @test |
|
171 | */ |
|
172 | public function testPutActionWhenEmployeeDoesNotExistReturns400() |
|
173 | { |
|
174 | $content = <<<JSON |
|
175 | { |
|
176 | "data": { |
|
177 | "type": "employee", |
|
178 | "id": 1000, |
|
179 | "attributes": { |
|
180 | "company": "NilPortugues.com", |
|
181 | "surname": "Portugués", |
|
182 | "first_name": "Nil", |
|
183 | "email_address": "nilportugues@localhost", |
|
184 | "job_title": "Full Stack Web Developer", |
|
185 | "business_phone": "(123)555-0100", |
|
186 | "home_phone": "(123)555-0102", |
|
187 | "mobile_phone": null, |
|
188 | "fax_number": "(123)555-0103", |
|
189 | "address": "Plaça Catalunya 1", |
|
190 | "city": "Barcelona", |
|
191 | "state_province": "Barcelona", |
|
192 | "zip_postal_code": "08028", |
|
193 | "country_region": "Spain", |
|
194 | "web_page": "http://nilportugues.com", |
|
195 | "notes": null, |
|
196 | "attachments": null |
|
197 | } |
|
198 | } |
|
199 | } |
|
200 | JSON; |
|
201 | $this->serverEnvironment('PUT', 'localhost', '/api/v1/employees/1000'); |
|
202 | $response = $this->call('PUT', 'http://localhost/api/v1/employees/1000', json_decode($content, true), [], [], []); |
|
203 | ||
204 | $this->assertEquals(400, $response->getStatusCode()); |
|
205 | $this->assertEquals('application/vnd.api+json', $response->headers->get('Content-type')); |
|
206 | } |
|
207 | ||
208 | /** |
|
209 | * @test |