diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-09-23 07:30:49 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-09-23 07:30:49 +0000 |
commit | 17a1595b312e5c9d0dac6d5b33685b457647cb8d (patch) | |
tree | 6c7a34f0d36b303da369196c15f252177861f6c1 /tests/BookmarkTest.php | |
parent | 930cfd784a59d95d574f87f24dfcb5fc590b5e78 (diff) | |
download | semanticscuttle-17a1595b312e5c9d0dac6d5b33685b457647cb8d.tar.gz semanticscuttle-17a1595b312e5c9d0dac6d5b33685b457647cb8d.tar.bz2 |
add more countother-watchlist tests that are simpler than the previous test
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@736 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r-- | tests/BookmarkTest.php | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 40869b2..40b40e3 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -1087,12 +1087,98 @@ class BookmarkTest extends TestBase /** * Test what countOther() returns when the user is logged in + * and a friend (people on the watchlist) has bookmarked + * and the same address with public status. + * + * @return void + */ + public function testCountOthersWatchlistPublic() + { + $uid = $this->addUser(); + $address = 'http://example.org'; + + //create other user and add main user to his watchlist + $friendPublic1 = $this->addUser(); + $this->us->setCurrentUserId($friendPublic1); + $this->us->setWatchStatus($uid); + + //create bookmarks for main user and other one + $this->addBookmark($uid, $address, 0); + $this->addBookmark($friendPublic1, $address, 0);//0 is public + + //log main user in + $this->us->setCurrentUserId($uid); + + $this->assertEquals(1, $this->bs->countOthers($address)); + } + + + + /** + * Test what countOther() returns when the user is logged in + * and a friend (people on the watchlist) has bookmarked + * and shared the same address for the watchlist. + * + * @return void + */ + public function testCountOthersWatchlistShared() + { + $uid = $this->addUser(); + $address = 'http://example.org'; + + //create other user and add main user to his watchlist + $friendPublic1 = $this->addUser(); + $this->us->setCurrentUserId($friendPublic1); + $this->us->setWatchStatus($uid); + + //create bookmarks for main user and other one + $this->addBookmark($uid, $address, 0); + $this->addBookmark($friendPublic1, $address, 1);//1 is shared + + //log main user in + $this->us->setCurrentUserId($uid); + + $this->assertEquals(1, $this->bs->countOthers($address)); + } + + + + /** + * Test what countOther() returns when the user is logged in + * and one friends (people on the watchlist) has bookmarked + * the same address but made it private. + * + * @return void + */ + public function testCountOthersWatchlistPrivate() + { + $uid = $this->addUser(); + $address = 'http://example.org'; + + //create other user and add main user to his watchlist + $friendPublic1 = $this->addUser(); + $this->us->setCurrentUserId($friendPublic1); + $this->us->setWatchStatus($uid); + + //create bookmarks for main user and other one + $this->addBookmark($uid, $address, 0); + $this->addBookmark($friendPublic1, $address, 2);//2 is private + + //log main user in + $this->us->setCurrentUserId($uid); + + $this->assertEquals(0, $this->bs->countOthers($address)); + } + + + /** + * Test what countOther() returns when the user is logged in * and friends (people on the watchlist) have bookmarked * and shared the same address. * * @return void */ - public function testCountOthersWatchlist() + public function testCountOthersWatchlistComplex() { $uid = $this->addUser(); $address = 'http://example.org'; |