diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-29 11:36:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 11:36:27 +0200 |
commit | 6cdca9562c7685e9a0eb77b51584d0cc458c44e0 (patch) | |
tree | 518de2057da549d0baa982c6aa689aa813377774 /tests/FileUtilsTest.php | |
parent | d0ae1ba273b6decea8d35ef79bfabb055b0fb6df (diff) | |
parent | b1baca99f280570d0336b4d71ad1f9dca213a35b (diff) | |
download | Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.gz Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.zst Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.zip |
Merge pull request #1572 from ArthurHoaro/feature/php8
Diffstat (limited to 'tests/FileUtilsTest.php')
-rw-r--r-- | tests/FileUtilsTest.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 57719175..6e8f44f2 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php | |||
@@ -19,7 +19,7 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase | |||
19 | /** | 19 | /** |
20 | * Delete test file after every test. | 20 | * Delete test file after every test. |
21 | */ | 21 | */ |
22 | public function tearDown() | 22 | protected function tearDown(): void |
23 | { | 23 | { |
24 | @unlink(self::$file); | 24 | @unlink(self::$file); |
25 | } | 25 | } |
@@ -49,12 +49,12 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase | |||
49 | 49 | ||
50 | /** | 50 | /** |
51 | * File not writable: raise an exception. | 51 | * File not writable: raise an exception. |
52 | * | ||
53 | * @expectedException Shaarli\Exceptions\IOException | ||
54 | * @expectedExceptionMessage Error accessing "sandbox/flat.db" | ||
55 | */ | 52 | */ |
56 | public function testWriteWithoutPermission() | 53 | public function testWriteWithoutPermission() |
57 | { | 54 | { |
55 | $this->expectException(\Shaarli\Exceptions\IOException::class); | ||
56 | $this->expectExceptionMessage('Error accessing "sandbox/flat.db"'); | ||
57 | |||
58 | touch(self::$file); | 58 | touch(self::$file); |
59 | chmod(self::$file, 0440); | 59 | chmod(self::$file, 0440); |
60 | FileUtils::writeFlatDB(self::$file, null); | 60 | FileUtils::writeFlatDB(self::$file, null); |
@@ -62,23 +62,23 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase | |||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Folder non existent: raise an exception. | 64 | * Folder non existent: raise an exception. |
65 | * | ||
66 | * @expectedException Shaarli\Exceptions\IOException | ||
67 | * @expectedExceptionMessage Error accessing "nopefolder" | ||
68 | */ | 65 | */ |
69 | public function testWriteFolderDoesNotExist() | 66 | public function testWriteFolderDoesNotExist() |
70 | { | 67 | { |
68 | $this->expectException(\Shaarli\Exceptions\IOException::class); | ||
69 | $this->expectExceptionMessage('Error accessing "nopefolder"'); | ||
70 | |||
71 | FileUtils::writeFlatDB('nopefolder/file', null); | 71 | FileUtils::writeFlatDB('nopefolder/file', null); |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Folder non writable: raise an exception. | 75 | * Folder non writable: raise an exception. |
76 | * | ||
77 | * @expectedException Shaarli\Exceptions\IOException | ||
78 | * @expectedExceptionMessage Error accessing "sandbox" | ||
79 | */ | 76 | */ |
80 | public function testWriteFolderPermission() | 77 | public function testWriteFolderPermission() |
81 | { | 78 | { |
79 | $this->expectException(\Shaarli\Exceptions\IOException::class); | ||
80 | $this->expectExceptionMessage('Error accessing "sandbox"'); | ||
81 | |||
82 | chmod(dirname(self::$file), 0555); | 82 | chmod(dirname(self::$file), 0555); |
83 | try { | 83 | try { |
84 | FileUtils::writeFlatDB(self::$file, null); | 84 | FileUtils::writeFlatDB(self::$file, null); |