aboutsummaryrefslogtreecommitdiff
path: root/tests/BookmarkTest.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-11-19 19:20:48 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-11-19 19:20:48 +0000
commitc93455201a37961cdf978c8505e21dbfc64b5974 (patch)
tree95bc66ae7cd4288c012933c14045674cda1b24e8 /tests/BookmarkTest.php
parent1565780efea67c584f6d1f60af28af47168ee22f (diff)
downloadsemanticscuttle-c93455201a37961cdf978c8505e21dbfc64b5974.tar.gz
semanticscuttle-c93455201a37961cdf978c8505e21dbfc64b5974.tar.bz2
test getBookmark() a bit more, and test "all" parameter with countBookmarks
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@557 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r--tests/BookmarkTest.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php
index dbb4172..9f02ae6 100644
--- a/tests/BookmarkTest.php
+++ b/tests/BookmarkTest.php
@@ -146,6 +146,7 @@ class BookmarkTest extends TestBase
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'public'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'private'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared'));
+ $this->assertEquals(0, $this->bs->countBookmarks($uid, 'all'));
}
@@ -163,6 +164,7 @@ class BookmarkTest extends TestBase
$this->assertEquals(1, $this->bs->countBookmarks($uid, 'public'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'private'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared'));
+ $this->assertEquals(1, $this->bs->countBookmarks($uid, 'all'));
}
@@ -184,6 +186,7 @@ class BookmarkTest extends TestBase
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'public'));
$this->assertEquals(1, $this->bs->countBookmarks($uid, 'private'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared'));
+ $this->assertEquals(1, $this->bs->countBookmarks($uid, 'all'));
}
@@ -205,6 +208,7 @@ class BookmarkTest extends TestBase
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'public'));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'private'));
$this->assertEquals(1, $this->bs->countBookmarks($uid, 'shared'));
+ $this->assertEquals(1, $this->bs->countBookmarks($uid, 'all'));
}
@@ -266,6 +270,54 @@ class BookmarkTest extends TestBase
/**
+ * Verify that getBookmark() returns false when the
+ * bookmark cannot be found.
+ *
+ * @return void
+ */
+ public function testGetBookmarkNotFound()
+ {
+ $this->assertFalse($this->bs->getBookmark(987654));
+ }
+
+
+
+ /**
+ * Verify that getBookmark() returns false when the
+ * bookmark ID is not numeric
+ *
+ * @return void
+ */
+ public function testGetBookmarkInvalidParam()
+ {
+ $this->assertFalse($this->bs->getBookmark('foo'));
+ }
+
+
+
+ /**
+ * Check tag loading functionality of getBookmark()
+ *
+ * @return void
+ */
+ public function testGetBookmarkIncludeTags()
+ {
+ $uid = $this->addUser();
+ $bid = $this->addBookmark($uid);
+ $this->b2ts->attachTags($bid, array('foo', 'bar'));
+ $bid2 = $this->addBookmark($uid);
+ $this->b2ts->attachTags($bid2, array('fuu', 'baz'));
+
+ $bm = $this->bs->getBookmark($bid, true);
+ $this->assertArrayHasKey('tags', $bm);
+ $this->assertType('array', $bm['tags']);
+ $this->assertContains('foo', $bm['tags']);
+ $this->assertContains('bar', $bm['tags']);
+ }
+
+
+
+ /**
* Verify that getBookmark() does not include user voting
* data when no user is logged on.
*