From a5a9cf23acd1248585173aa32757d9720b5f2d62 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 29 Sep 2020 14:41:40 +0200 Subject: Compatibility with PHPUnit 9 --- tests/bookmark/BookmarkArrayTest.php | 5 +---- tests/bookmark/BookmarkFileServiceTest.php | 4 ++-- tests/bookmark/BookmarkFilterTest.php | 2 +- tests/bookmark/BookmarkInitializerTest.php | 2 +- tests/bookmark/BookmarkTest.php | 12 ++++++------ tests/bookmark/LinkUtilsTest.php | 22 +++++++++++----------- 6 files changed, 22 insertions(+), 25 deletions(-) (limited to 'tests/bookmark') diff --git a/tests/bookmark/BookmarkArrayTest.php b/tests/bookmark/BookmarkArrayTest.php index bad3af8d..ebed9bfc 100644 --- a/tests/bookmark/BookmarkArrayTest.php +++ b/tests/bookmark/BookmarkArrayTest.php @@ -2,10 +2,7 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; -use Shaarli\Bookmark\Exception\InvalidBookmarkException; -use Shaarli\Config\ConfigManager; -use Shaarli\History; +use Shaarli\TestCase; /** * Class BookmarkArrayTest diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php index 9cff0fb3..51e71a85 100644 --- a/tests/bookmark/BookmarkFileServiceTest.php +++ b/tests/bookmark/BookmarkFileServiceTest.php @@ -6,7 +6,6 @@ namespace Shaarli\Bookmark; use DateTime; -use PHPUnit\Framework\TestCase; use ReferenceLinkDB; use ReflectionClass; use Shaarli; @@ -14,6 +13,7 @@ use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Config\ConfigManager; use Shaarli\Formatter\BookmarkMarkdownFormatter; use Shaarli\History; +use Shaarli\TestCase; /** * Unitary tests for LegacyLinkDBTest @@ -748,7 +748,7 @@ class BookmarkFileServiceTest extends TestCase $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/'); $this->assertNotEquals(false, $link); - $this->assertContains( + $this->assertContainsPolyfill( 'A free software media publishing platform', $link->getDescription() ); diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php index 752631a5..2f15cb3c 100644 --- a/tests/bookmark/BookmarkFilterTest.php +++ b/tests/bookmark/BookmarkFilterTest.php @@ -3,10 +3,10 @@ namespace Shaarli\Bookmark; use Exception; -use PHPUnit\Framework\TestCase; use ReferenceLinkDB; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; /** * Class BookmarkFilterTest. diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php index 454269bb..25704004 100644 --- a/tests/bookmark/BookmarkInitializerTest.php +++ b/tests/bookmark/BookmarkInitializerTest.php @@ -2,9 +2,9 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; /** * Class BookmarkInitializerTest diff --git a/tests/bookmark/BookmarkTest.php b/tests/bookmark/BookmarkTest.php index 4b6a3c07..afec2440 100644 --- a/tests/bookmark/BookmarkTest.php +++ b/tests/bookmark/BookmarkTest.php @@ -2,8 +2,8 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Exception\InvalidBookmarkException; +use Shaarli\TestCase; /** * Class BookmarkTest @@ -150,7 +150,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ID: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ID: '. PHP_EOL, $exception->getMessage()); } /** @@ -169,7 +169,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ID: str'. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ID: str'. PHP_EOL, $exception->getMessage()); } /** @@ -188,7 +188,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ShortUrl: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ShortUrl: '. PHP_EOL, $exception->getMessage()); } /** @@ -207,7 +207,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- Created: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- Created: '. PHP_EOL, $exception->getMessage()); } /** @@ -226,7 +226,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); } /** diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php index 7d4a7b89..a7087953 100644 --- a/tests/bookmark/LinkUtilsTest.php +++ b/tests/bookmark/LinkUtilsTest.php @@ -2,7 +2,7 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; require_once 'tests/utils/CurlUtils.php'; @@ -437,13 +437,13 @@ class LinkUtilsTest extends TestCase カタカナ #カタカナ」カタカナ\n'; $autolinkedDescription = hashtag_autolink($rawDescription, $index); - $this->assertContains($this->getHashtagLink('hashtag', $index), $autolinkedDescription); - $this->assertNotContains(' #hashtag', $autolinkedDescription); - $this->assertNotContains('>#nothashtag', $autolinkedDescription); - $this->assertContains($this->getHashtagLink('ашок', $index), $autolinkedDescription); - $this->assertContains($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); - $this->assertContains($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); - $this->assertNotContains($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag', $index), $autolinkedDescription); + $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription); + $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('ашок', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); + $this->assertNotContainsPolyfill($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); } /** @@ -454,9 +454,9 @@ class LinkUtilsTest extends TestCase $rawDescription = 'blabla #hashtag x#nothashtag'; $autolinkedDescription = hashtag_autolink($rawDescription); - $this->assertContains($this->getHashtagLink('hashtag'), $autolinkedDescription); - $this->assertNotContains(' #hashtag', $autolinkedDescription); - $this->assertNotContains('>#nothashtag', $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag'), $autolinkedDescription); + $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription); + $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription); } /** -- cgit v1.2.3