namespace Shaarli;
use DateTime;
-use Exception;
use Shaarli\Bookmark\Bookmark;
-class HistoryTest extends \PHPUnit\Framework\TestCase
+class HistoryTest extends \Shaarli\TestCase
{
/**
* @var string History file path
/**
* Delete history file.
*/
- public function setUp()
+ protected function setUp(): void
{
if (file_exists(self::$historyFilePath)) {
unlink(self::$historyFilePath);
/**
* Not writable history file: raise an exception.
- *
- * @expectedException Exception
- * @expectedExceptionMessage History file isn't readable or writable
*/
public function testConstructNotWritable()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('History file isn\'t readable or writable');
+
touch(self::$historyFilePath);
chmod(self::$historyFilePath, 0440);
$history = new History(self::$historyFilePath);
/**
* Not parsable history file: raise an exception.
- *
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Could not parse history file/
*/
public function testConstructNotParsable()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Could not parse history file/');
+
file_put_contents(self::$historyFilePath, 'not parsable');
$history = new History(self::$historyFilePath);
// gzinflate generates a warning