summaryrefslogtreecommitdiff
path: root/tests/BookmarkTest.php
diff options
context:
space:
mode:
authorMark Pemberton <mpemberton5@gmail.com>2011-05-13 14:26:51 -0400
committerMark Pemberton <mpemberton5@gmail.com>2011-05-13 14:26:51 -0400
commitec345f7a1343769abdf3f5920a0732b24726b733 (patch)
tree1a65f2f0bea89b16f5c8e93264b67e2927570677 /tests/BookmarkTest.php
parent803b83fb7d051593066b5224a59fbf3ec6efc824 (diff)
downloadsemanticscuttle-ec345f7a1343769abdf3f5920a0732b24726b733.tar.gz
semanticscuttle-ec345f7a1343769abdf3f5920a0732b24726b733.tar.bz2
new privatekey2 branch with privatekey changes
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r--tests/BookmarkTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php
index b50dab2..44a82d9 100644
--- a/tests/BookmarkTest.php
+++ b/tests/BookmarkTest.php
@@ -1330,5 +1330,51 @@ class BookmarkTest extends TestBase
+ /**
+ * Test private bookmarks
+ *
+ * @return void
+ */
+ public function testPrivateBookmarks()
+ {
+ $uid = $this->addUser();
+ /* create private bookmark */
+ $this->bs->addBookmark(
+ 'http://test', 'test', 'desc', 'note',
+ 2,//private
+ array(), null, null, false, false, $uid
+ );
+ /* create public bookmark */
+ $this->bs->addBookmark(
+ 'http://example.org', 'title', 'desc', 'priv',
+ 0,//public
+ array(), null, null, false, false, $uid
+ );
+
+ $this->assertEquals(1, $this->bs->countBookmarks($uid, 'public'));
+ $this->assertEquals(1, $this->bs->countBookmarks($uid, 'private'));
+ $this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared'));
+ $this->assertEquals(2, $this->bs->countBookmarks($uid, 'all'));
+
+ $this->us->setCurrentUserId($uid);
+ $bookmarks = $this->bs->getBookmarks();
+ // first record should be private bookmark
+ $b0 = $bookmarks['bookmarks'][0];
+ $this->assertEquals('test', $b0['bTitle']);
+ // second record should be public bookmark
+ $b0 = $bookmarks['bookmarks'][1];
+ $this->assertEquals('title', $b0['bTitle']);
+
+ // test non authenticated query
+ $this->us->setCurrentUserId(null);
+ $bookmarks = $this->bs->getBookmarks();
+ // should only result in one link - public
+ $b2 = $bookmarks['bookmarks'][0];
+ $this->assertEquals('title', $b2['bTitle']);
+ // there should be no second record
+ $this->assertEquals(1,count($bookmarks['bookmarks']));
+
+ }
+
}
?>