SwiftTest.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christian Berendt <berendt@b1-systems.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Robin McCorkell <robin@mccorkell.me.uk>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. * @author Thomas Müller <thomas.mueller@tmit.eu>
  12. *
  13. * @license AGPL-3.0
  14. *
  15. * This code is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License, version 3,
  17. * as published by the Free Software Foundation.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License, version 3,
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>
  26. *
  27. */
  28. namespace OCA\Files_External\Tests\Storage;
  29. use GuzzleHttp\Exception\ClientException;
  30. use OCA\Files_External\Lib\Storage\Swift;
  31. /**
  32. * Class SwiftTest
  33. *
  34. * @group DB
  35. *
  36. * @package OCA\Files_External\Tests\Storage
  37. */
  38. class SwiftTest extends \Test\Files\Storage\Storage {
  39. private $config;
  40. /**
  41. * @var Swift instance
  42. */
  43. protected $instance;
  44. protected function setUp(): void {
  45. parent::setUp();
  46. $this->config = include('files_external/tests/config.swift.php');
  47. if (!is_array($this->config) or !$this->config['run']) {
  48. $this->markTestSkipped('OpenStack Object Storage backend not configured');
  49. }
  50. $this->instance = new Swift($this->config);
  51. }
  52. protected function tearDown(): void {
  53. if ($this->instance) {
  54. try {
  55. $container = $this->instance->getContainer();
  56. $objects = $container->listObjects();
  57. foreach ($objects as $object) {
  58. $object->delete();
  59. }
  60. $container->delete();
  61. } catch (ClientException $e) {
  62. // container didn't exist, so we don't need to delete it
  63. }
  64. }
  65. parent::tearDown();
  66. }
  67. public function testStat() {
  68. $this->markTestSkipped('Swift doesn\'t update the parents folder mtime');
  69. }
  70. }