namespace Shaarli\Updater;
use Exception;
-use PHPUnit\Framework\TestCase;
use Shaarli\Bookmark\BookmarkFileService;
use Shaarli\Bookmark\BookmarkServiceInterface;
use Shaarli\Config\ConfigManager;
use Shaarli\History;
+use Shaarli\TestCase;
/**
/**
* Executed before each test.
*/
- public function setUp()
+ protected function setUp(): void
{
$this->refDB = new \ReferenceLinkDB();
$this->refDB->write(self::$testDatastore);
/**
* Test errors in UpdaterUtils::write_updates_file(): empty updates file.
- *
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Updates file path is not set(.*)/
*/
public function testWriteEmptyUpdatesFile()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/');
+
UpdaterUtils::write_updates_file('', array('test'));
}
/**
* Test errors in UpdaterUtils::write_updates_file(): not writable updates file.
- *
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Unable to write(.*)/
*/
public function testWriteUpdatesFileNotWritable()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Unable to write(.*)/');
+
$updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';
touch($updatesFile);
chmod($updatesFile, 0444);
/**
* Test Update failed.
- *
- * @expectedException \Exception
*/
public function testUpdateFailed()
{
+ $this->expectException(\Exception::class);
+
$updates = array(
'updateMethodDummy1',
'updateMethodDummy2',