From 3866f388b1c7a476be1ae5fd1cd044e5a112feec Mon Sep 17 00:00:00 2001 From: Bernd Rederlechner Date: Thu, 8 Jul 2021 15:19:39 +0200 Subject: Refactor writeObject to only use MultipartUpload when required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernd Rederlechner Co-authored-by: Julius Härtl --- tests/lib/Files/ObjectStore/ObjectStoreTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/lib/Files/ObjectStore/ObjectStoreTest.php') diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTest.php b/tests/lib/Files/ObjectStore/ObjectStoreTest.php index 4ec44eb410d..a245f0ae366 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreTest.php @@ -26,11 +26,27 @@ use Test\TestCase; abstract class ObjectStoreTest extends TestCase { + /** @var string[] */ + private $cleanup = []; + /** * @return \OCP\Files\ObjectStore\IObjectStore */ abstract protected function getInstance(); + protected function cleanupAfter(string $urn) { + $this->cleanup[] = $urn; + } + + public function tearDown(): void { + parent::tearDown(); + + $instance = $this->getInstance(); + foreach ($this->cleanup as $urn) { + $instance->deleteObject($urn); + } + } + protected function stringToStream($data) { $stream = fopen('php://temp', 'w+'); fwrite($stream, $data); @@ -110,6 +126,9 @@ abstract class ObjectStoreTest extends TestCase { } public function testCopy() { + $this->cleanupAfter('source'); + $this->cleanupAfter('target'); + $stream = $this->stringToStream('foobar'); $instance = $this->getInstance(); -- cgit v1.2.3