From 8f60e1206e45e67c96a7630d4ff94e72fe875f09 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 26 Sep 2020 15:08:39 +0200 Subject: Comply with PHPUnit V8: setup/teardown functions must return void --- tests/FileUtilsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/FileUtilsTest.php') diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 57719175..eb9cb89a 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -19,7 +19,7 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase /** * Delete test file after every test. */ - public function tearDown() + protected function tearDown(): void { @unlink(self::$file); } -- cgit v1.2.3 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 From a5a9cf23acd1248585173aa32757d9720b5f2d62 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 29 Sep 2020 14:41:40 +0200 Subject: Compatibility with PHPUnit 9 --- tests/FileUtilsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/FileUtilsTest.php') diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 6e8f44f2..9163bdf1 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -9,7 +9,7 @@ use Exception; * * Test file utility class. */ -class FileUtilsTest extends \PHPUnit\Framework\TestCase +class FileUtilsTest extends \Shaarli\TestCase { /** * @var string Test file path. -- cgit v1.2.3