aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Storage/LocalTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Storage/LocalTest.php')
-rw-r--r--tests/lib/Files/Storage/LocalTest.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php
index 13317fad7bb..e3953b7bde5 100644
--- a/tests/lib/Files/Storage/LocalTest.php
+++ b/tests/lib/Files/Storage/LocalTest.php
@@ -7,8 +7,13 @@
namespace Test\Files\Storage;
+use OC\Files\Storage\Local;
use OC\Files\Storage\Wrapper\Jail;
use OCP\Files;
+use OCP\Files\ForbiddenException;
+use OCP\Files\StorageNotAvailableException;
+use OCP\ITempManager;
+use OCP\Server;
/**
* Class LocalTest
@@ -26,8 +31,8 @@ class LocalTest extends Storage {
protected function setUp(): void {
parent::setUp();
- $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
- $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]);
+ $this->tmpDir = Server::get(ITempManager::class)->getTemporaryFolder();
+ $this->instance = new Local(['datadir' => $this->tmpDir]);
}
protected function tearDown(): void {
@@ -55,19 +60,19 @@ class LocalTest extends Storage {
public function testInvalidArgumentsEmptyArray(): void {
$this->expectException(\InvalidArgumentException::class);
- new \OC\Files\Storage\Local([]);
+ new Local([]);
}
public function testInvalidArgumentsNoArray(): void {
$this->expectException(\InvalidArgumentException::class);
- new \OC\Files\Storage\Local([]);
+ new Local([]);
}
public function testDisallowSymlinksOutsideDatadir(): void {
- $this->expectException(\OCP\Files\ForbiddenException::class);
+ $this->expectException(ForbiddenException::class);
$subDir1 = $this->tmpDir . 'sub1';
$subDir2 = $this->tmpDir . 'sub2';
@@ -77,7 +82,7 @@ class LocalTest extends Storage {
symlink($subDir2, $sym);
- $storage = new \OC\Files\Storage\Local(['datadir' => $subDir1]);
+ $storage = new Local(['datadir' => $subDir1]);
$storage->file_put_contents('sym/foo', 'bar');
}
@@ -91,7 +96,7 @@ class LocalTest extends Storage {
symlink($subDir2, $sym);
- $storage = new \OC\Files\Storage\Local(['datadir' => $subDir1]);
+ $storage = new Local(['datadir' => $subDir1]);
$storage->file_put_contents('sym/foo', 'bar');
$this->addToAssertionCount(1);
@@ -129,12 +134,12 @@ class LocalTest extends Storage {
}
public function testUnavailableExternal(): void {
- $this->expectException(\OCP\Files\StorageNotAvailableException::class);
- $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist', 'isExternal' => true]);
+ $this->expectException(StorageNotAvailableException::class);
+ $this->instance = new Local(['datadir' => $this->tmpDir . '/unexist', 'isExternal' => true]);
}
public function testUnavailableNonExternal(): void {
- $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist']);
+ $this->instance = new Local(['datadir' => $this->tmpDir . '/unexist']);
// no exception thrown
$this->assertNotNull($this->instance);
}