diff options
Diffstat (limited to 'apps/files_external/tests/backends/swift.php')
-rw-r--r-- | apps/files_external/tests/backends/swift.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/files_external/tests/backends/swift.php b/apps/files_external/tests/backends/swift.php index 4ca2d1db7bd..83b27e6e82e 100644 --- a/apps/files_external/tests/backends/swift.php +++ b/apps/files_external/tests/backends/swift.php @@ -41,16 +41,20 @@ class Swift extends Storage { protected function tearDown() { if ($this->instance) { - $connection = $this->instance->getConnection(); - $container = $connection->getContainer($this->config['bucket']); - - $objects = $container->objectList(); - while($object = $objects->next()) { - $object->setName(str_replace('#','%23',$object->getName())); - $object->delete(); + try { + $connection = $this->instance->getConnection(); + $container = $connection->getContainer($this->config['bucket']); + + $objects = $container->objectList(); + while($object = $objects->next()) { + $object->setName(str_replace('#','%23',$object->getName())); + $object->delete(); + } + + $container->delete(); + } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) { + // container didn't exist, so we don't need to delete it } - - $container->delete(); } parent::tearDown(); |