aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FileUtilsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FileUtilsTest.php')
-rw-r--r--tests/FileUtilsTest.php18
1 files changed, 9 insertions, 9 deletions
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
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);