aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HistoryTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-29 11:36:27 +0200
committerGitHub <noreply@github.com>2020-09-29 11:36:27 +0200
commit6cdca9562c7685e9a0eb77b51584d0cc458c44e0 (patch)
tree518de2057da549d0baa982c6aa689aa813377774 /tests/HistoryTest.php
parentd0ae1ba273b6decea8d35ef79bfabb055b0fb6df (diff)
parentb1baca99f280570d0336b4d71ad1f9dca213a35b (diff)
downloadShaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.gz
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.zst
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.zip
Merge pull request #1572 from ArthurHoaro/feature/php8
Diffstat (limited to 'tests/HistoryTest.php')
-rw-r--r--tests/HistoryTest.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php
index 7189c3a9..fb633e79 100644
--- a/tests/HistoryTest.php
+++ b/tests/HistoryTest.php
@@ -16,7 +16,7 @@ class HistoryTest extends \PHPUnit\Framework\TestCase
16 /** 16 /**
17 * Delete history file. 17 * Delete history file.
18 */ 18 */
19 public function setUp() 19 protected function setUp(): void
20 { 20 {
21 if (file_exists(self::$historyFilePath)) { 21 if (file_exists(self::$historyFilePath)) {
22 unlink(self::$historyFilePath); 22 unlink(self::$historyFilePath);
@@ -44,12 +44,12 @@ class HistoryTest extends \PHPUnit\Framework\TestCase
44 44
45 /** 45 /**
46 * Not writable history file: raise an exception. 46 * Not writable history file: raise an exception.
47 *
48 * @expectedException Exception
49 * @expectedExceptionMessage History file isn't readable or writable
50 */ 47 */
51 public function testConstructNotWritable() 48 public function testConstructNotWritable()
52 { 49 {
50 $this->expectException(\Exception::class);
51 $this->expectExceptionMessage('History file isn\'t readable or writable');
52
53 touch(self::$historyFilePath); 53 touch(self::$historyFilePath);
54 chmod(self::$historyFilePath, 0440); 54 chmod(self::$historyFilePath, 0440);
55 $history = new History(self::$historyFilePath); 55 $history = new History(self::$historyFilePath);
@@ -58,12 +58,12 @@ class HistoryTest extends \PHPUnit\Framework\TestCase
58 58
59 /** 59 /**
60 * Not parsable history file: raise an exception. 60 * Not parsable history file: raise an exception.
61 *
62 * @expectedException Exception
63 * @expectedExceptionMessageRegExp /Could not parse history file/
64 */ 61 */
65 public function testConstructNotParsable() 62 public function testConstructNotParsable()
66 { 63 {
64 $this->expectException(\Exception::class);
65 $this->expectExceptionMessageRegExp('/Could not parse history file/');
66
67 file_put_contents(self::$historyFilePath, 'not parsable'); 67 file_put_contents(self::$historyFilePath, 'not parsable');
68 $history = new History(self::$historyFilePath); 68 $history = new History(self::$historyFilePath);
69 // gzinflate generates a warning 69 // gzinflate generates a warning