From b1baca99f280570d0336b4d71ad1f9dca213a35b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 27 Sep 2020 14:07:08 +0200 Subject: Convert legacy PHPUnit @expected* to new ->expect* Converted automatically using https://github.com/ArthurHoaro/convert-legacy-phpunit-expect --- tests/FileUtilsTest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/FileUtilsTest.php') diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index eb9cb89a..6e8f44f2 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -49,12 +49,12 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase /** * File not writable: raise an exception. - * - * @expectedException Shaarli\Exceptions\IOException - * @expectedExceptionMessage Error accessing "sandbox/flat.db" */ public function testWriteWithoutPermission() { + $this->expectException(\Shaarli\Exceptions\IOException::class); + $this->expectExceptionMessage('Error accessing "sandbox/flat.db"'); + touch(self::$file); chmod(self::$file, 0440); FileUtils::writeFlatDB(self::$file, null); @@ -62,23 +62,23 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase /** * Folder non existent: raise an exception. - * - * @expectedException Shaarli\Exceptions\IOException - * @expectedExceptionMessage Error accessing "nopefolder" */ public function testWriteFolderDoesNotExist() { + $this->expectException(\Shaarli\Exceptions\IOException::class); + $this->expectExceptionMessage('Error accessing "nopefolder"'); + FileUtils::writeFlatDB('nopefolder/file', null); } /** * Folder non writable: raise an exception. - * - * @expectedException Shaarli\Exceptions\IOException - * @expectedExceptionMessage Error accessing "sandbox" */ public function testWriteFolderPermission() { + $this->expectException(\Shaarli\Exceptions\IOException::class); + $this->expectExceptionMessage('Error accessing "sandbox"'); + chmod(dirname(self::$file), 0555); try { FileUtils::writeFlatDB(self::$file, null); -- cgit v1.2.3