2012-04-18 14:54:07 -04:00
|
|
|
<?php
|
2025-05-17 05:46:26 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2012-04-18 14:54:07 -04:00
|
|
|
/**
|
2024-06-06 03:55:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2012-04-18 14:54:07 -04:00
|
|
|
*/
|
2016-04-13 18:18:07 -04:00
|
|
|
namespace OCA\Files_External\Tests\Storage;
|
|
|
|
|
|
2018-02-12 09:08:27 -05:00
|
|
|
use GuzzleHttp\Exception\ClientException;
|
2019-11-22 14:52:10 -05:00
|
|
|
use OCA\Files_External\Lib\Storage\Swift;
|
2012-09-22 08:51:15 -04:00
|
|
|
|
2015-11-19 10:42:29 -05:00
|
|
|
/**
|
2016-04-13 18:18:07 -04:00
|
|
|
* Class SwiftTest
|
2015-11-19 10:42:29 -05:00
|
|
|
*
|
|
|
|
|
*
|
2016-04-13 18:18:07 -04:00
|
|
|
* @package OCA\Files_External\Tests\Storage
|
2015-11-19 10:42:29 -05:00
|
|
|
*/
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
2016-04-13 18:18:07 -04:00
|
|
|
class SwiftTest extends \Test\Files\Storage\Storage {
|
2025-09-26 03:39:33 -04:00
|
|
|
use ConfigurableStorageTrait;
|
2012-04-18 14:54:07 -04:00
|
|
|
|
2018-02-12 09:08:27 -05:00
|
|
|
/**
|
|
|
|
|
* @var Swift instance
|
|
|
|
|
*/
|
|
|
|
|
protected $instance;
|
|
|
|
|
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function setUp(): void {
|
2014-11-10 16:28:12 -05:00
|
|
|
parent::setUp();
|
|
|
|
|
|
2025-12-18 10:10:06 -05:00
|
|
|
$this->loadConfig(__DIR__ . '/../config.swift.php');
|
2016-04-13 18:18:07 -04:00
|
|
|
$this->instance = new Swift($this->config);
|
2012-10-11 15:12:52 -04:00
|
|
|
}
|
2012-04-18 14:54:07 -04:00
|
|
|
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function tearDown(): void {
|
2012-10-11 15:12:52 -04:00
|
|
|
if ($this->instance) {
|
2015-09-23 15:31:22 -04:00
|
|
|
try {
|
2018-02-12 09:08:27 -05:00
|
|
|
$container = $this->instance->getContainer();
|
2015-09-23 15:31:22 -04:00
|
|
|
|
2018-02-12 09:08:27 -05:00
|
|
|
$objects = $container->listObjects();
|
|
|
|
|
foreach ($objects as $object) {
|
2015-09-23 15:31:22 -04:00
|
|
|
$object->delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$container->delete();
|
2018-02-12 09:08:27 -05:00
|
|
|
} catch (ClientException $e) {
|
2015-09-23 15:31:22 -04:00
|
|
|
// container didn't exist, so we don't need to delete it
|
2013-10-22 07:36:23 -04:00
|
|
|
}
|
2012-04-18 14:54:07 -04:00
|
|
|
}
|
2014-11-10 16:28:12 -05:00
|
|
|
|
|
|
|
|
parent::tearDown();
|
2012-04-18 14:54:07 -04:00
|
|
|
}
|
2015-09-24 09:33:54 -04:00
|
|
|
|
|
|
|
|
public function testStat(): void {
|
|
|
|
|
$this->markTestSkipped('Swift doesn\'t update the parents folder mtime');
|
|
|
|
|
}
|
2012-04-18 14:54:07 -04:00
|
|
|
}
|