X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Ffeed%2FFeedBuilderTest.php;h=6b9204eb64949cb17ada2c26bf605e7f9a3373a4;hb=ce901a58289c72bf7f4dc3515a2be70562cd618b;hp=5dfe73aa49ce9bf047ecc2833ed8bc9375e85c3b;hpb=85b972baf67c61ebabf1ce332358e4dfd2456a4e;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php index 5dfe73aa..6b9204eb 100644 --- a/tests/feed/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php @@ -3,7 +3,7 @@ namespace Shaarli\Feed; use DateTime; -use PHPUnit\Framework\TestCase; +use malkusch\lock\mutex\NoMutex; use ReferenceLinkDB; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\BookmarkFileService; @@ -11,6 +11,7 @@ use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; +use Shaarli\TestCase; /** * FeedBuilderTest class. @@ -47,6 +48,7 @@ class FeedBuilderTest extends TestCase */ public static function setUpBeforeClass(): void { + $mutex = new NoMutex(); $conf = new ConfigManager('tests/utils/config/configJson'); $conf->set('resource.datastore', self::$testDatastore); $refLinkDB = new \ReferenceLinkDB(); @@ -54,7 +56,7 @@ class FeedBuilderTest extends TestCase $history = new History('sandbox/history.php'); $factory = new FormatterFactory($conf, true); self::$formatter = $factory->getFormatter(); - self::$bookmarkService = new BookmarkFileService($conf, $history, true); + self::$bookmarkService = new BookmarkFileService($conf, $history, $mutex, true); self::$serverInfo = array( 'HTTPS' => 'Off', @@ -97,9 +99,9 @@ class FeedBuilderTest extends TestCase $pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']); $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']); $this->assertEquals($pub, $up); - $this->assertContains('Stallman has a beard', $link['description']); - $this->assertContains('Permalink', $link['description']); - $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); + $this->assertContainsPolyfill('Stallman has a beard', $link['description']); + $this->assertContainsPolyfill('Permalink', $link['description']); + $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']); $this->assertEquals(1, count($link['taglist'])); $this->assertEquals('sTuff', $link['taglist'][0]); @@ -201,16 +203,16 @@ class FeedBuilderTest extends TestCase $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']); $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']); - $this->assertContains('Direct link', $link['description']); - $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); + $this->assertContainsPolyfill('Direct link', $link['description']); + $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']); // Second link is a direct link $link = $data['links'][array_keys($data['links'])[1]]; $this->assertEquals(8, $link['id']); $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']); $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); - $this->assertContains('Direct link', $link['description']); - $this->assertContains('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']); + $this->assertContainsPolyfill('Direct link', $link['description']); + $this->assertContainsPolyfill('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']); } /** @@ -274,6 +276,6 @@ class FeedBuilderTest extends TestCase $link = $data['links'][array_keys($data['links'])[0]]; $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']); $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']); - $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); + $this->assertContainsPolyfill('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); } }