|
@@ 196-207 (lines=12) @@
|
| 193 |
|
unset($_SERVER['PHP_AUTH_PW']); |
| 194 |
|
} |
| 195 |
|
|
| 196 |
|
public function testPostWithoutBodyReturnsNoContent() |
| 197 |
|
{ |
| 198 |
|
$_SERVER['PHP_AUTH_USER'] = '[email protected]'; |
| 199 |
|
$_SERVER['PHP_AUTH_PW'] = 'editor'; |
| 200 |
|
|
| 201 |
|
$url = '/api/v1/RestfulServerTest_Comment'; |
| 202 |
|
$response = Director::test($url, null, null, 'POST'); |
| 203 |
|
|
| 204 |
|
$this->assertEquals('No Content', $response->getBody()); |
| 205 |
|
|
| 206 |
|
unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
public function testPUTwithJSON() |
| 210 |
|
{ |
|
@@ 289-300 (lines=12) @@
|
| 286 |
|
$this->assertEquals($response->getHeader('Content-Type'), 'application/json'); |
| 287 |
|
} |
| 288 |
|
|
| 289 |
|
public function testNotFound() |
| 290 |
|
{ |
| 291 |
|
$_SERVER['PHP_AUTH_USER'] = '[email protected]'; |
| 292 |
|
$_SERVER['PHP_AUTH_PW'] = 'user'; |
| 293 |
|
|
| 294 |
|
$url = "/api/v1/RestfulServerTest_Comment/99"; |
| 295 |
|
$response = Director::test($url, null, null, 'GET'); |
| 296 |
|
$this->assertEquals($response->getStatusCode(), 404); |
| 297 |
|
|
| 298 |
|
unset($_SERVER['PHP_AUTH_USER']); |
| 299 |
|
unset($_SERVER['PHP_AUTH_PW']); |
| 300 |
|
} |
| 301 |
|
|
| 302 |
|
public function testMethodNotAllowed() |
| 303 |
|
{ |