X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FHistoryTest.php;h=9152584509db8a8f7ac98107e15cdecefc17beb2;hb=d16ca2e22f3d7325fc9593fccd8523eebe226567;hp=79322249d0da8ddf3b099dafe9f5c49388e73709;hpb=4306b184c4471825f916d895b047ed03fdf58985;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php index 79322249..91525845 100644 --- a/tests/HistoryTest.php +++ b/tests/HistoryTest.php @@ -21,9 +21,19 @@ class HistoryTest extends PHPUnit_Framework_TestCase /** * Test that the history file is created if it doesn't exist. */ - public function testConstructFileCreated() + public function testConstructLazyLoading() { new History(self::$historyFilePath); + $this->assertFileNotExists(self::$historyFilePath); + } + + /** + * Test that the history file is created if it doesn't exist. + */ + public function testAddEventCreateFile() + { + $history = new History(self::$historyFilePath); + $history->updateSettings(); $this->assertFileExists(self::$historyFilePath); } @@ -37,7 +47,8 @@ class HistoryTest extends PHPUnit_Framework_TestCase { touch(self::$historyFilePath); chmod(self::$historyFilePath, 0440); - new History(self::$historyFilePath); + $history = new History(self::$historyFilePath); + $history->updateSettings(); } /** @@ -49,8 +60,9 @@ class HistoryTest extends PHPUnit_Framework_TestCase public function testConstructNotParsable() { file_put_contents(self::$historyFilePath, 'not parsable'); + $history = new History(self::$historyFilePath); // gzinflate generates a warning - @new History(self::$historyFilePath); + @$history->updateSettings(); } /**