diff options
Diffstat (limited to 'tests/lib/Files/PathVerificationTest.php')
-rw-r--r-- | tests/lib/Files/PathVerificationTest.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index fcbe0a6957f..8e4dfd1bb1e 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -10,6 +10,8 @@ namespace Test\Files; use OC\Files\Storage\Local; use OC\Files\View; use OCP\Files\InvalidPathException; +use OCP\IDBConnection; +use OCP\Server; /** * Class PathVerificationTest @@ -31,7 +33,7 @@ class PathVerificationTest extends \Test\TestCase { public function testPathVerificationFileNameTooLong(): void { - $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectException(InvalidPathException::class); $this->expectExceptionMessage('Filename is too long'); $fileName = str_repeat('a', 500); @@ -43,13 +45,13 @@ class PathVerificationTest extends \Test\TestCase { * @dataProvider providesEmptyFiles */ public function testPathVerificationEmptyFileName($fileName): void { - $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectException(InvalidPathException::class); $this->expectExceptionMessage('Empty filename is not allowed'); $this->view->verifyPath('', $fileName); } - public function providesEmptyFiles() { + public static function providesEmptyFiles(): array { return [ [''], [' '], @@ -60,13 +62,13 @@ class PathVerificationTest extends \Test\TestCase { * @dataProvider providesDotFiles */ public function testPathVerificationDotFiles($fileName): void { - $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectException(InvalidPathException::class); $this->expectExceptionMessage('Dot files are not allowed'); $this->view->verifyPath('', $fileName); } - public function providesDotFiles() { + public static function providesDotFiles(): array { return [ ['.'], ['..'], @@ -83,7 +85,7 @@ class PathVerificationTest extends \Test\TestCase { * @dataProvider providesAstralPlane */ public function testPathVerificationAstralPlane($fileName): void { - $connection = \OC::$server->getDatabaseConnection(); + $connection = Server::get(IDBConnection::class); if (!$connection->supports4ByteText()) { $this->expectException(InvalidPathException::class); @@ -95,7 +97,7 @@ class PathVerificationTest extends \Test\TestCase { $this->view->verifyPath('', $fileName); } - public function providesAstralPlane() { + public static function providesAstralPlane(): array { return [ // this is the monkey emoji - http://en.wikipedia.org/w/index.php?title=%F0%9F%90%B5&redirect=no ['🐵'], @@ -117,7 +119,7 @@ class PathVerificationTest extends \Test\TestCase { $this->addToAssertionCount(1); } - public function providesValidPosixPaths() { + public static function providesValidPosixPaths(): array { return [ ['simple'], ['simple.txt'], |