/**
* Unitary tests for Shaarli utilities
*/
-class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase
+class ApplicationUtilsTest extends \Shaarli\TestCase
{
protected static $testUpdateFile = 'sandbox/update.txt';
protected static $testVersion = '0.5.0';
/**
* Reset test data for each test
*/
- public function setUp()
+ protected function setUp(): void
{
FakeApplicationUtils::$VERSION_CODE = '';
if (file_exists(self::$testUpdateFile)) {
/**
* Remove test version file if it exists
*/
- public function tearDown()
+ protected function tearDown(): void
{
if (is_file('sandbox/version.php')) {
unlink('sandbox/version.php');
/**
* Test update checks - invalid Git branch
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Invalid branch selected for updates/
*/
public function testCheckUpdateInvalidGitBranch()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Invalid branch selected for updates/');
+
ApplicationUtils::checkUpdate('', 'null', 0, true, true, 'unstable');
}
/**
* Check a unsupported PHP version
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Your PHP version is obsolete/
*/
public function testCheckSupportedPHPVersion51()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/');
+
$this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0'));
}
/**
* Check another unsupported PHP version
- * @expectedException Exception
- * @expectedExceptionMessageRegExp /Your PHP version is obsolete/
*/
public function testCheckSupportedPHPVersion52()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/');
+
$this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2'));
}