| @@ 211-229 (lines=19) @@ | ||
| 208 | * |
|
| 209 | * @return void |
|
| 210 | */ |
|
| 211 | public function testPostNewFile() |
|
| 212 | { |
|
| 213 | $client = static::createRestClient(); |
|
| 214 | ||
| 215 | $client->post( |
|
| 216 | '/file', |
|
| 217 | file_get_contents(__DIR__.'/fixtures/test.txt'), |
|
| 218 | [], |
|
| 219 | [], |
|
| 220 | ['CONTENT_TYPE' => 'text/plain'], |
|
| 221 | false |
|
| 222 | ); |
|
| 223 | ||
| 224 | $response = $client->getResponse(); |
|
| 225 | $linkHeader = $response->headers->get('Link'); |
|
| 226 | ||
| 227 | $this->assertEquals(201, $response->getStatusCode()); |
|
| 228 | $this->assertRegExp('@/file/[a-z0-9]{32}>; rel="self"@', $linkHeader); |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|
| 232 | * validate that we can put a new file with a custom id |
|
| @@ 236-254 (lines=19) @@ | ||
| 233 | * |
|
| 234 | * @return void |
|
| 235 | */ |
|
| 236 | public function testPutNewFile() |
|
| 237 | { |
|
| 238 | $client = static::createRestClient(); |
|
| 239 | ||
| 240 | $client->put( |
|
| 241 | '/file/testPutNewFile', |
|
| 242 | file_get_contents(__DIR__ . '/fixtures/test.txt'), |
|
| 243 | [], |
|
| 244 | [], |
|
| 245 | ['CONTENT_TYPE' => 'text/plain'], |
|
| 246 | false |
|
| 247 | ); |
|
| 248 | ||
| 249 | $response = $client->getResponse(); |
|
| 250 | $linkHeader = $response->headers->get('Link'); |
|
| 251 | ||
| 252 | $this->assertEquals(204, $response->getStatusCode()); |
|
| 253 | $this->assertContains('file/testPutNewFile>; rel="self"', $linkHeader); |
|
| 254 | } |
|
| 255 | ||
| 256 | /** |
|
| 257 | * validate that we can delete a file |
|