Fix missing @expectedException convertion

This commit is contained in:
ArthurHoaro 2020-09-29 18:41:21 +02:00
parent ab58f25420
commit f447edb73b
8 changed files with 14 additions and 20 deletions

View file

@ -144,10 +144,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
/**
* Test update checks - invalid Git branch
* @expectedException Exception
*/
public function testCheckUpdateInvalidGitBranch()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid branch selected for updates/');
ApplicationUtils::checkUpdate('', 'null', 0, true, true, 'unstable');
@ -261,10 +261,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
/**
* Check a unsupported PHP version
* @expectedException Exception
*/
public function testCheckSupportedPHPVersion51()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Your PHP version is obsolete/');
$this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0'));
@ -272,10 +272,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
/**
* Check another unsupported PHP version
* @expectedException Exception
*/
public function testCheckSupportedPHPVersion52()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Your PHP version is obsolete/');
$this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2'));

View file

@ -637,11 +637,10 @@ class BookmarkFileServiceTest extends TestCase
*/
/**
* Attempt to instantiate a LinkDB whereas the datastore is not writable
*
* @expectedException Shaarli\Bookmark\Exception\NotWritableDataStoreException
*/
public function testConstructDatastoreNotWriteable()
{
$this->expectException(\Shaarli\Bookmark\Exception\NotWritableDataStoreException::class);
$this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#');
$conf = new ConfigManager('tests/utils/config/configJson');

View file

@ -212,10 +212,10 @@ class BookmarkFilterTest extends TestCase
/**
* Use an invalid date format
* @expectedException Exception
*/
public function testFilterInvalidDayWithChars()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid date format/');
self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away');
@ -223,10 +223,10 @@ class BookmarkFilterTest extends TestCase
/**
* Use an invalid date format
* @expectedException Exception
*/
public function testFilterInvalidDayDigits()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid date format/');
self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20');

View file

@ -99,11 +99,10 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
/**
* Attempt to instantiate a LinkDB whereas the datastore is not writable
*
* @expectedException Shaarli\Exceptions\IOException
*/
public function testConstructDatastoreNotWriteable()
{
$this->expectException(\Shaarli\Exceptions\IOException::class);
$this->expectExceptionMessageRegExp('/Error accessing "null"/');
new LegacyLinkDB('null/store.db', false, false);

View file

@ -197,10 +197,10 @@ class LegacyLinkFilterTest extends \Shaarli\TestCase
/**
* Use an invalid date format
* @expectedException Exception
*/
public function testFilterInvalidDayWithChars()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid date format/');
self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away');
@ -208,10 +208,10 @@ class LegacyLinkFilterTest extends \Shaarli\TestCase
/**
* Use an invalid date format
* @expectedException Exception
*/
public function testFilterInvalidDayDigits()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid date format/');
self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20');

View file

@ -80,11 +80,10 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
/**
* Test errors in UpdaterUtils::write_updates_file(): empty updates file.
*
* @expectedException Exception
*/
public function testWriteEmptyUpdatesFile()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/');
UpdaterUtils::write_updates_file('', array('test'));
@ -92,11 +91,10 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
/**
* Test errors in UpdaterUtils::write_updates_file(): not writable updates file.
*
* @expectedException Exception
*/
public function testWriteUpdatesFileNotWritable()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Unable to write(.*)/');
$updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';

View file

@ -77,10 +77,10 @@ class BookmarkExportTest extends TestCase
/**
* Attempt to export an invalid link selection
* @expectedException Exception
*/
public function testFilterAndFormatInvalid()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Invalid export selection/');
$this->netscapeBookmarkUtils->filterAndFormat(

View file

@ -87,11 +87,10 @@ class UpdaterTest extends TestCase
/**
* Test errors in UpdaterUtils::write_updates_file(): empty updates file.
*
* @expectedException Exception
*/
public function testWriteEmptyUpdatesFile()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/');
UpdaterUtils::write_updates_file('', array('test'));
@ -99,11 +98,10 @@ class UpdaterTest extends TestCase
/**
* Test errors in UpdaterUtils::write_updates_file(): not writable updates file.
*
* @expectedException Exception
*/
public function testWriteUpdatesFileNotWritable()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Unable to write(.*)/');
$updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';