File tree Expand file tree Collapse file tree 2 files changed +10
-18
lines changed
lib/OpenCloud/ObjectStore/Resource
tests/OpenCloud/Tests/ObjectStore/Resource Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -239,22 +239,13 @@ public function deleteAllObjects()
239
239
* Delete an object from the API.
240
240
*
241
241
* @param string $name The name of object you want to delete
242
- * @return True if object was delete with success. False if an error occurred
243
- * @throws ObjectNotFoundException When the file you want to delete is not found
242
+ * @throws \Guzzle\Http\Exception\BadResponseException When an error occurred
244
243
*/
245
244
public function deleteObject ($ name )
246
245
{
247
- try {
248
- $ response = $ this ->getClient ()
249
- ->delete ($ this ->getUrl ($ name ))
250
- ->send ();
251
- return ($ response ->getStatusCode () == 204 );
252
- } catch (BadResponseException $ e ) {
253
- if ($ e ->getResponse ()->getStatusCode () == 404 ) {
254
- throw ObjectNotFoundException::factory ($ name , $ e );
255
- }
256
- }
257
- return false ;
246
+ $ response = $ this ->getClient ()
247
+ ->delete ($ this ->getUrl ($ name ))
248
+ ->send ();
258
249
}
259
250
260
251
/**
Original file line number Diff line number Diff line change @@ -122,20 +122,21 @@ public function test_Delete_Object()
122
122
{
123
123
$ container = $ this ->container ;
124
124
$ this ->addMockSubscriber ($ this ->makeResponse ('[] ' , 204 ));
125
- $ response = $ container ->deleteObject ("someObject " );
126
- $ this ->assertTrue ($ response );
125
+ $ container ->deleteObject ("someObject " );
127
126
}
128
127
128
+ /**
129
+ * @expectedException \Guzzle\Http\Exception\BadResponseException
130
+ */
129
131
public function test_Delete_Object_With_Failure ()
130
132
{
131
133
$ container = $ this ->container ;
132
134
$ this ->addMockSubscriber ($ this ->makeResponse ('[] ' , 500 ));
133
- $ response = $ container ->deleteObject ("someObject " );
134
- $ this ->assertFalse ($ response );
135
+ $ container ->deleteObject ("someObject " );
135
136
}
136
137
137
138
/**
138
- * @expectedException \OpenCloud\ObjectStore \Exception\ObjectNotFoundException
139
+ * @expectedException \Guzzle\Http \Exception\BadResponseException
139
140
*/
140
141
public function test_Delete_NonExisting_Object ()
141
142
{
You can’t perform that action at this time.
0 commit comments