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.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index daafd250..47970117 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -898,6 +898,37 @@ class BookmarkFileServiceTest extends TestCase
898 } 898 }
899 899
900 /** 900 /**
901 * Test filterHash() on a private bookmark while logged out.
902 */
903 public function testFilterHashPrivateWhileLoggedOut()
904 {
905 $this->expectException(\Exception::class);
906 $this->expectExceptionMessage('Not authorized');
907
908 $hash = smallHash('20141125_084734' . 6);
909
910 $this->publicLinkDB->findByHash($hash);
911 }
912
913 /**
914 * Test filterHash() with private key.
915 */
916 public function testFilterHashWithPrivateKey()
917 {
918 $hash = smallHash('20141125_084734' . 6);
919 $privateKey = 'this is usually auto generated';
920
921 $bookmark = $this->privateLinkDB->findByHash($hash);
922 $bookmark->addAdditionalContentEntry('private_key', $privateKey);
923 $this->privateLinkDB->save();
924
925 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, false);
926 $bookmark = $this->privateLinkDB->findByHash($hash, $privateKey);
927
928 static::assertSame(6, $bookmark->getId());
929 }
930
931 /**
901 * Test linksCountPerTag all tags without filter. 932 * Test linksCountPerTag all tags without filter.
902 * Equal occurrences should be sorted alphabetically. 933 * Equal occurrences should be sorted alphabetically.
903 */ 934 */