| @@ 171-191 (lines=21) @@ | ||
| 168 | /** |
|
| 169 | * @depends testCreateDatabase |
|
| 170 | */ |
|
| 171 | public function testGetDocumentFromNotExistantDatabase() |
|
| 172 | { |
|
| 173 | $db = new HTTP\SocketClient(); |
|
| 174 | ||
| 175 | try |
|
| 176 | { |
|
| 177 | $db->request( 'DELETE', '/' . $this->getTestDatabase() ); |
|
| 178 | } catch ( \Exception $e ) { /* Ignore */ } |
|
| 179 | ||
| 180 | $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 181 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 182 | ||
| 183 | $this->assertSame( 404, $response->status ); |
|
| 184 | $this->assertSame( |
|
| 185 | array( |
|
| 186 | 'error' => 'not_found', |
|
| 187 | 'reason' => 'no_db_file', |
|
| 188 | ), |
|
| 189 | $response->body |
|
| 190 | ); |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * @depends testCreateDatabase |
|
| @@ 196-212 (lines=17) @@ | ||
| 193 | /** |
|
| 194 | * @depends testCreateDatabase |
|
| 195 | */ |
|
| 196 | public function testDeleteUnknownDocumentFromDatabase() |
|
| 197 | { |
|
| 198 | $db = new HTTP\SocketClient(); |
|
| 199 | ||
| 200 | $db->request( 'PUT', '/' . $this->getTestDatabase() ); |
|
| 201 | $response = $db->request( 'DELETE', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 202 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 203 | ||
| 204 | $this->assertSame( 404, $response->status ); |
|
| 205 | $this->assertSame( |
|
| 206 | array( |
|
| 207 | 'error' => 'not_found', |
|
| 208 | 'reason' => 'missing', |
|
| 209 | ), |
|
| 210 | $response->body |
|
| 211 | ); |
|
| 212 | } |
|
| 213 | ||
| 214 | /** |
|
| 215 | * @depends testCreateDatabase |
|
| @@ 186-205 (lines=20) @@ | ||
| 183 | /** |
|
| 184 | * @depends testCreateDatabase |
|
| 185 | */ |
|
| 186 | public function testGetDocumentFromNotExistantDatabase() |
|
| 187 | { |
|
| 188 | $db = new HTTP\StreamClient(); |
|
| 189 | ||
| 190 | try { |
|
| 191 | $db->request( 'DELETE', '/' . $this->getTestDatabase() . '' ); |
|
| 192 | } catch ( \Exception $e ) { /* Ignore */ } |
|
| 193 | ||
| 194 | $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 195 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 196 | ||
| 197 | $this->assertSame( 404, $response->status ); |
|
| 198 | $this->assertSame( |
|
| 199 | array( |
|
| 200 | 'error' => 'not_found', |
|
| 201 | 'reason' => 'no_db_file', |
|
| 202 | ), |
|
| 203 | $response->body |
|
| 204 | ); |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * @depends testCreateDatabase |
|