diff options
Diffstat (limited to 'tests/lib/Files/ObjectStore/ObjectStoreTest.php')
-rw-r--r-- | tests/lib/Files/ObjectStore/ObjectStoreTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
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(); |