aboutsummaryrefslogtreecommitdiff
path: root/tests/BookmarkTest.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-02-20 11:03:20 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-02-20 11:03:20 +0000
commit6b7217daf298be65347205aa7a0fee17ff37b87c (patch)
treedfad051bbe4cb81ddebb9ab405dafaf56770f426 /tests/BookmarkTest.php
parent91da444e762bd2676e94a19d45401d2e83858202 (diff)
downloadsemanticscuttle-6b7217daf298be65347205aa7a0fee17ff37b87c.tar.gz
semanticscuttle-6b7217daf298be65347205aa7a0fee17ff37b87c.tar.bz2
make countOthers() accept an array of addresses
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@659 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r--tests/BookmarkTest.php80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php
index d791b9e..69e6e8a 100644
--- a/tests/BookmarkTest.php
+++ b/tests/BookmarkTest.php
@@ -943,6 +943,86 @@ class BookmarkTest extends TestBase
+ /**
+ * Test what countOther() returns when multiple addresses are
+ * passed to it and none of them exists.
+ *
+ * @return void
+ */
+ public function testCountOthersArrayNone()
+ {
+ $this->assertEquals(
+ array('1' => 0, '2' => 0, '3' => 0),
+ $this->bs->countOthers(array('1', '2', '3'))
+ );
+ }
+
+
+
+ /**
+ * Test what countOther() returns when multiple addresses are
+ * passed to it and only one of them exists.
+ *
+ * @return void
+ */
+ public function testCountOthersArrayOneNone()
+ {
+ $uid = $this->addUser();
+ $uid2 = $this->addUser();
+ $address1 = 'http://example.org/1';
+ $address2 = 'http://example.org/2';
+ $this->addBookmark($uid, $address1);
+ $this->addBookmark($uid, $address2);
+ $this->addBookmark($uid2, $address1);
+ $this->assertEquals(
+ array(
+ $address1 => 1,
+ $address2 => 0
+ ),
+ $this->bs->countOthers(
+ array($address1, $address2)
+ )
+ );
+ }
+
+
+
+ /**
+ * Test what countOther() returns when multiple addresses are passed
+ * to it and both of them exist with different numbers for each.
+ *
+ * @return void
+ */
+ public function testCountOthersArrayTwoOne()
+ {
+ $uid = $this->addUser();
+ $uid2 = $this->addUser();
+ $uid3 = $this->addUser();
+
+ $address1 = 'http://example.org/1';
+ $address2 = 'http://example.org/2';
+
+ $this->addBookmark($uid, $address1);
+ $this->addBookmark($uid, $address2);
+
+ $this->addBookmark($uid2, $address1);
+ $this->addBookmark($uid2, $address2);
+
+ $this->addBookmark($uid3, $address1);
+
+ $this->assertEquals(
+ array(
+ $address1 => 2,
+ $address2 => 1
+ ),
+ $this->bs->countOthers(
+ array($address1, $address2)
+ )
+ );
+ }
+
+
+
}