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/legacy/LegacyControllerTest.php | 2 +- tests/legacy/LegacyLinkDBTest.php | 12 ++++++------ tests/legacy/LegacyLinkFilterTest.php | 2 +- tests/legacy/LegacyUpdaterTest.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/legacy') diff --git a/tests/legacy/LegacyControllerTest.php b/tests/legacy/LegacyControllerTest.php index 4e52f3e1..1a2549a3 100644 --- a/tests/legacy/LegacyControllerTest.php +++ b/tests/legacy/LegacyControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Legacy; -use PHPUnit\Framework\TestCase; use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php index 819bc272..66746dfc 100644 --- a/tests/legacy/LegacyLinkDBTest.php +++ b/tests/legacy/LegacyLinkDBTest.php @@ -18,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; /** * Unitary tests for LegacyLinkDBTest */ -class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase +class LegacyLinkDBTest extends \Shaarli\TestCase { // datastore to test write operations protected static $testDatastore = 'sandbox/datastore.php'; @@ -258,7 +258,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); $this->assertNotEquals(false, $link); - $this->assertContains( + $this->assertContainsPolyfill( 'A free software media publishing platform', $link['description'] ); @@ -471,9 +471,9 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $res = $linkDB->renameTag('cartoon', 'Taz'); $this->assertEquals(3, count($res)); - $this->assertContains(' Taz ', $linkDB[4]['tags']); - $this->assertContains(' Taz ', $linkDB[1]['tags']); - $this->assertContains(' Taz ', $linkDB[0]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']); } /** @@ -513,7 +513,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $res = $linkDB->renameTag('cartoon', null); $this->assertEquals(3, count($res)); - $this->assertNotContains('cartoon', $linkDB[4]['tags']); + $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']); } /** diff --git a/tests/legacy/LegacyLinkFilterTest.php b/tests/legacy/LegacyLinkFilterTest.php index 9db921a9..82bc93d8 100644 --- a/tests/legacy/LegacyLinkFilterTest.php +++ b/tests/legacy/LegacyLinkFilterTest.php @@ -10,7 +10,7 @@ use Shaarli\Legacy\LegacyLinkFilter; /** * Class LegacyLinkFilterTest. */ -class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase +class LegacyLinkFilterTest extends \Shaarli\TestCase { /** * @var string Test datastore path. diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php index acfac530..0ddcb4a6 100644 --- a/tests/legacy/LegacyUpdaterTest.php +++ b/tests/legacy/LegacyUpdaterTest.php @@ -20,7 +20,7 @@ require_once 'inc/rain.tpl.class.php'; * Class UpdaterTest. * Runs unit tests against the updater class. */ -class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase +class LegacyUpdaterTest extends \Shaarli\TestCase { /** * @var string Path to test datastore. @@ -725,7 +725,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode')); $this->assertEquals(125, $this->conf->get('thumbnails.width')); $this->assertEquals(90, $this->conf->get('thumbnails.height')); - $this->assertContains('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); + $this->assertContainsPolyfill('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); } /** -- cgit v1.2.3