]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fix missing @expectedException convertion
authorArthurHoaro <arthur@hoa.ro>
Tue, 29 Sep 2020 16:41:21 +0000 (18:41 +0200)
committerArthurHoaro <arthur@hoa.ro>
Tue, 29 Sep 2020 16:57:25 +0000 (18:57 +0200)
tests/ApplicationUtilsTest.php
tests/bookmark/BookmarkFileServiceTest.php
tests/bookmark/BookmarkFilterTest.php
tests/legacy/LegacyLinkDBTest.php
tests/legacy/LegacyLinkFilterTest.php
tests/legacy/LegacyUpdaterTest.php
tests/netscape/BookmarkExportTest.php
tests/updater/UpdaterTest.php

index 7ad1d34c0c5f54da31a49fc4f1d7bb5fe9732f8e..a232b351f4cfdae5c63c4d31553f055500a4111b 100644 (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'));
index 51e71a854d4ea14df83994dc27aabb985e6b2e36..c399822b5801520b78c511d91cff5d312ba2b693 100644 (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');
index 2f15cb3c66017f1482748ae409c9102e3f23fe41..48c7f8247bc02ca32900886e7f7d86aac90027c8 100644 (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');
index 66746dfc9c00d666998f920707c59090b59da017..df2cad62295594145843eac725bff46bec8068e3 100644 (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);
index 82bc93d8f9a235b9056832555feb9fffe2924470..45d7754d34a82cd5ff22fe52f12663c268bd3c46 100644 (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');
index 0ddcb4a6fc190ec10c0923a8623c2594df10edbb..f7391b867f593efd932aba8ae66f46ab6a1685fd 100644 (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';
index adf62f4f249248bd943acd2743abf0f50529350d..9b95ccc9eaf9338fbbed007ef63b1f300450ed6a 100644 (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(
index 73029e07395cdab39040c7285f5273d29740f04d..a6280b8c9b911a8d3b33ac0d4af2684304a49256 100644 (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';