aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark/BookmarkFileServiceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bookmark/BookmarkFileServiceTest.php')
-rw-r--r--tests/bookmark/BookmarkFileServiceTest.php48
1 files changed, 41 insertions, 7 deletions
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index 7b1906d3..a4ec1013 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -615,14 +615,18 @@ class BookmarkFileServiceTest extends TestCase
615 { 615 {
616 $dbSize = $this->privateLinkDB->count(); 616 $dbSize = $this->privateLinkDB->count();
617 $this->privateLinkDB->initialize(); 617 $this->privateLinkDB->initialize();
618 $this->assertEquals($dbSize + 2, $this->privateLinkDB->count()); 618 $this->assertEquals($dbSize + 3, $this->privateLinkDB->count());
619 $this->assertEquals( 619 $this->assertStringStartsWith(
620 'My secret stuff... - Pastebin.com', 620 'Shaarli will automatically pick up the thumbnail for links to a variety of websites.',
621 $this->privateLinkDB->get(43)->getTitle() 621 $this->privateLinkDB->get(43)->getDescription()
622 ); 622 );
623 $this->assertEquals( 623 $this->assertStringStartsWith(
624 'The personal, minimalist, super-fast, database free, bookmarking service', 624 'Adding a shaare without entering a URL creates a text-only "note" post such as this one.',
625 $this->privateLinkDB->get(44)->getTitle() 625 $this->privateLinkDB->get(44)->getDescription()
626 );
627 $this->assertStringStartsWith(
628 'Welcome to Shaarli!',
629 $this->privateLinkDB->get(45)->getDescription()
626 ); 630 );
627 } 631 }
628 632
@@ -1062,6 +1066,36 @@ class BookmarkFileServiceTest extends TestCase
1062 } 1066 }
1063 1067
1064 /** 1068 /**
1069 * Test filterDay while logged in
1070 */
1071 public function testFilterDayLoggedIn(): void
1072 {
1073 $bookmarks = $this->privateLinkDB->filterDay('20121206');
1074 $expectedIds = [4, 9, 1, 0];
1075
1076 static::assertCount(4, $bookmarks);
1077 foreach ($bookmarks as $bookmark) {
1078 $i = ($i ?? -1) + 1;
1079 static::assertSame($expectedIds[$i], $bookmark->getId());
1080 }
1081 }
1082
1083 /**
1084 * Test filterDay while logged out
1085 */
1086 public function testFilterDayLoggedOut(): void
1087 {
1088 $bookmarks = $this->publicLinkDB->filterDay('20121206');
1089 $expectedIds = [4, 9, 1];
1090
1091 static::assertCount(3, $bookmarks);
1092 foreach ($bookmarks as $bookmark) {
1093 $i = ($i ?? -1) + 1;
1094 static::assertSame($expectedIds[$i], $bookmark->getId());
1095 }
1096 }
1097
1098 /**
1065 * Allows to test LinkDB's private methods 1099 * Allows to test LinkDB's private methods
1066 * 1100 *
1067 * @see 1101 * @see