| @@ 232-250 (lines=19) @@ | ||
| 229 | * |
|
| 230 | * @return void |
|
| 231 | */ |
|
| 232 | public function testPostNewFile() |
|
| 233 | { |
|
| 234 | $client = static::createRestClient(); |
|
| 235 | ||
| 236 | $client->post( |
|
| 237 | '/file', |
|
| 238 | file_get_contents(__DIR__.'/fixtures/test.txt'), |
|
| 239 | [], |
|
| 240 | [], |
|
| 241 | ['CONTENT_TYPE' => 'text/plain'], |
|
| 242 | false |
|
| 243 | ); |
|
| 244 | ||
| 245 | $response = $client->getResponse(); |
|
| 246 | $linkHeader = $response->headers->get('Link'); |
|
| 247 | ||
| 248 | $this->assertEquals(201, $response->getStatusCode()); |
|
| 249 | $this->assertRegExp('@/file/[a-z0-9]{32}>; rel="self"@', $linkHeader); |
|
| 250 | } |
|
| 251 | ||
| 252 | /** |
|
| 253 | * validate that we can put a new file with a custom id |
|
| @@ 257-275 (lines=19) @@ | ||
| 254 | * |
|
| 255 | * @return void |
|
| 256 | */ |
|
| 257 | public function testPutNewFile() |
|
| 258 | { |
|
| 259 | $client = static::createRestClient(); |
|
| 260 | ||
| 261 | $client->put( |
|
| 262 | '/file/testPutNewFile', |
|
| 263 | file_get_contents(__DIR__ . '/fixtures/test.txt'), |
|
| 264 | [], |
|
| 265 | [], |
|
| 266 | ['CONTENT_TYPE' => 'text/plain'], |
|
| 267 | false |
|
| 268 | ); |
|
| 269 | ||
| 270 | $response = $client->getResponse(); |
|
| 271 | $linkHeader = $response->headers->get('Link'); |
|
| 272 | ||
| 273 | $this->assertEquals(204, $response->getStatusCode()); |
|
| 274 | $this->assertContains('file/testPutNewFile>; rel="self"', $linkHeader); |
|
| 275 | } |
|
| 276 | ||
| 277 | /** |
|
| 278 | * validate that we can delete a file |
|