From: ArthurHoaro Date: Sat, 12 Sep 2020 10:14:18 +0000 (+0200) Subject: Merge pull request #1552 from ArthurHoaro/feature/better-initializer X-Git-Tag: v0.12.0-beta-1~17 X-Git-Url: https://git.immae.eu/?p=github%2Fshaarli%2FShaarli.git;a=commitdiff_plain;h=6128ab6a55430a2b705be31ff417c0c552a0db1f;hp=-c Merge pull request #1552 from ArthurHoaro/feature/better-initializer --- 6128ab6a55430a2b705be31ff417c0c552a0db1f diff --combined tests/bookmark/BookmarkFileServiceTest.php index c59fd443,a91f374f..a4ec1013 --- a/tests/bookmark/BookmarkFileServiceTest.php +++ b/tests/bookmark/BookmarkFileServiceTest.php @@@ -615,14 -615,18 +615,18 @@@ class BookmarkFileServiceTest extends T { $dbSize = $this->privateLinkDB->count(); $this->privateLinkDB->initialize(); - $this->assertEquals($dbSize + 2, $this->privateLinkDB->count()); - $this->assertEquals( - 'My secret stuff... - Pastebin.com', - $this->privateLinkDB->get(43)->getTitle() + $this->assertEquals($dbSize + 3, $this->privateLinkDB->count()); + $this->assertStringStartsWith( + 'Shaarli will automatically pick up the thumbnail for links to a variety of websites.', + $this->privateLinkDB->get(43)->getDescription() ); - $this->assertEquals( - 'The personal, minimalist, super-fast, database free, bookmarking service', - $this->privateLinkDB->get(44)->getTitle() + $this->assertStringStartsWith( + 'Adding a shaare without entering a URL creates a text-only "note" post such as this one.', + $this->privateLinkDB->get(44)->getDescription() + ); + $this->assertStringStartsWith( + 'Welcome to Shaarli!', + $this->privateLinkDB->get(45)->getDescription() ); } @@@ -1061,36 -1065,6 +1065,36 @@@ $this->assertEquals($expected, $tags, var_export($tags, true)); } + /** + * Test filterDay while logged in + */ + public function testFilterDayLoggedIn(): void + { + $bookmarks = $this->privateLinkDB->filterDay('20121206'); + $expectedIds = [4, 9, 1, 0]; + + static::assertCount(4, $bookmarks); + foreach ($bookmarks as $bookmark) { + $i = ($i ?? -1) + 1; + static::assertSame($expectedIds[$i], $bookmark->getId()); + } + } + + /** + * Test filterDay while logged out + */ + public function testFilterDayLoggedOut(): void + { + $bookmarks = $this->publicLinkDB->filterDay('20121206'); + $expectedIds = [4, 9, 1]; + + static::assertCount(3, $bookmarks); + foreach ($bookmarks as $bookmark) { + $i = ($i ?? -1) + 1; + static::assertSame($expectedIds[$i], $bookmark->getId()); + } + } + /** * Allows to test LinkDB's private methods *