| @@ 55-70 (lines=16) @@ | ||
| 52 | /** |
|
| 53 | * @depends testCreateDatabase |
|
| 54 | */ |
|
| 55 | public function testForErrorOnDatabaseRecreation() |
|
| 56 | { |
|
| 57 | $db = new HTTP\SocketClient(); |
|
| 58 | ||
| 59 | $response = $db->request( 'PUT', '/' . $this->getTestDatabase() ); |
|
| 60 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 61 | ||
| 62 | $this->assertSame( 412, $response->status ); |
|
| 63 | $this->assertSame( |
|
| 64 | array( |
|
| 65 | 'error' => 'file_exists', |
|
| 66 | 'reason' => 'The database could not be created, the file already exists.', |
|
| 67 | ), |
|
| 68 | $response->body |
|
| 69 | ); |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @depends testCreateDatabase |
|
| @@ 151-166 (lines=16) @@ | ||
| 148 | /** |
|
| 149 | * @depends testCreateDatabase |
|
| 150 | */ |
|
| 151 | public function testGetUnknownDocumentFromDatabase() |
|
| 152 | { |
|
| 153 | $db = new HTTP\SocketClient(); |
|
| 154 | ||
| 155 | $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 156 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 157 | ||
| 158 | $this->assertSame( 404, $response->status ); |
|
| 159 | $this->assertSame( |
|
| 160 | array( |
|
| 161 | 'error' => 'not_found', |
|
| 162 | 'reason' => 'missing', |
|
| 163 | ), |
|
| 164 | $response->body |
|
| 165 | ); |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * @depends testCreateDatabase |
|
| @@ 70-85 (lines=16) @@ | ||
| 67 | /** |
|
| 68 | * @depends testCreateDatabase |
|
| 69 | */ |
|
| 70 | public function testForErrorOnDatabaseRecreation() |
|
| 71 | { |
|
| 72 | $db = new HTTP\StreamClient(); |
|
| 73 | ||
| 74 | $response = $db->request( 'PUT', '/' . $this->getTestDatabase() . '' ); |
|
| 75 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 76 | ||
| 77 | $this->assertSame( 412, $response->status ); |
|
| 78 | $this->assertSame( |
|
| 79 | array( |
|
| 80 | 'error' => 'file_exists', |
|
| 81 | 'reason' => 'The database could not be created, the file already exists.', |
|
| 82 | ), |
|
| 83 | $response->body |
|
| 84 | ); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * @depends testCreateDatabase |
|
| @@ 166-181 (lines=16) @@ | ||
| 163 | /** |
|
| 164 | * @depends testCreateDatabase |
|
| 165 | */ |
|
| 166 | public function testGetUnknownDocumentFromDatabase() |
|
| 167 | { |
|
| 168 | $db = new HTTP\StreamClient(); |
|
| 169 | ||
| 170 | $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 171 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 172 | ||
| 173 | $this->assertSame( 404, $response->status ); |
|
| 174 | $this->assertSame( |
|
| 175 | array( |
|
| 176 | 'error' => 'not_found', |
|
| 177 | 'reason' => 'missing', |
|
| 178 | ), |
|
| 179 | $response->body |
|
| 180 | ); |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * @depends testCreateDatabase |
|
| @@ 210-225 (lines=16) @@ | ||
| 207 | /** |
|
| 208 | * @depends testCreateDatabase |
|
| 209 | */ |
|
| 210 | public function testDeleteUnknownDocumentFromDatabase() |
|
| 211 | { |
|
| 212 | $db = new HTTP\StreamClient(); |
|
| 213 | ||
| 214 | $response = $db->request( 'DELETE', '/' . $this->getTestDatabase() . '/not_existant' ); |
|
| 215 | $this->assertInstanceOf('HTTP\ErrorResponse', $response); |
|
| 216 | ||
| 217 | $this->assertSame( 404, $response->status ); |
|
| 218 | $this->assertSame( |
|
| 219 | array( |
|
| 220 | 'error' => 'not_found', |
|
| 221 | 'reason' => 'no_db_file', |
|
| 222 | ), |
|
| 223 | $response->body |
|
| 224 | ); |
|
| 225 | } |
|
| 226 | ||
| 227 | /** |
|
| 228 | * @depends testCreateDatabase |
|