]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/bookmark/BookmarkFileServiceTest.php
Merge pull request #1552 from ArthurHoaro/feature/better-initializer
[github/shaarli/Shaarli.git] / tests / bookmark / BookmarkFileServiceTest.php
index a91f374f0f984f9f3a2357a962192945e9c588b4..a4ec10138b75c30bfb6a78c9726f3dc9f49229bf 100644 (file)
@@ -1065,6 +1065,36 @@ class BookmarkFileServiceTest extends TestCase
         $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
      *