diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-23 20:31:22 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-20 14:45:16 +0200 |
commit | 70f4e9413fc4b7f676ecdb6b437751182a07dc56 (patch) | |
tree | 5f81348aabbad63807a7e9e988950e9282126817 /apps | |
parent | 0de9819da378590fee73c805b5e52661452eb141 (diff) | |
download | nextcloud-server-70f4e9413fc4b7f676ecdb6b437751182a07dc56.tar.gz nextcloud-server-70f4e9413fc4b7f676ecdb6b437751182a07dc56.zip |
Make Swift test robust if container didn't exist
Diffstat (limited to 'apps')
-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(); |