diff options
Diffstat (limited to 'tests/lib/Files/PathVerificationTest.php')
-rw-r--r-- | tests/lib/Files/PathVerificationTest.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index 7e0b7dd2650..18637daf9d7 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -25,16 +25,16 @@ class PathVerificationTest extends \Test\TestCase { */ private $view; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->view = new View(); } - /** - * @expectedException \OCP\Files\InvalidPathException - * @expectedExceptionMessage File name is too long - */ + public function testPathVerificationFileNameTooLong() { + $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectExceptionMessage('File name is too long'); + $fileName = str_repeat('a', 500); $this->view->verifyPath('', $fileName); } @@ -42,10 +42,11 @@ class PathVerificationTest extends \Test\TestCase { /** * @dataProvider providesEmptyFiles - * @expectedException \OCP\Files\InvalidPathException - * @expectedExceptionMessage Empty filename is not allowed */ public function testPathVerificationEmptyFileName($fileName) { + $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectExceptionMessage('Empty filename is not allowed'); + $this->view->verifyPath('', $fileName); } @@ -58,10 +59,11 @@ class PathVerificationTest extends \Test\TestCase { /** * @dataProvider providesDotFiles - * @expectedException \OCP\Files\InvalidPathException - * @expectedExceptionMessage Dot files are not allowed */ public function testPathVerificationDotFiles($fileName) { + $this->expectException(\OCP\Files\InvalidPathException::class); + $this->expectExceptionMessage('Dot files are not allowed'); + $this->view->verifyPath('', $fileName); } @@ -107,9 +109,10 @@ class PathVerificationTest extends \Test\TestCase { /** * @dataProvider providesInvalidCharsPosix - * @expectedException \OCP\Files\InvalidCharacterInPathException */ public function testPathVerificationInvalidCharsPosix($fileName) { + $this->expectException(\OCP\Files\InvalidCharacterInPathException::class); + $storage = new Local(['datadir' => '']); $fileName = " 123{$fileName}456 "; |