aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HistoryTest.php
diff options
context:
space:
mode:
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