]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
add more countother-watchlist tests that are simpler than the previous test
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Thu, 23 Sep 2010 07:30:49 +0000 (07:30 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Thu, 23 Sep 2010 07:30:49 +0000 (07:30 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@736 b3834d28-1941-0410-a4f8-b48e95affb8f

tests/BookmarkTest.php

index 40869b2a258480902795f73e69f187411785486d..40b40e34731d957432faadebcdbcf1aade476711 100644 (file)
@@ -1085,6 +1085,92 @@ 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
@@ -1092,7 +1178,7 @@ class BookmarkTest extends TestBase
      *
      * @return void
      */
-    public function testCountOthersWatchlist()
+    public function testCountOthersWatchlistComplex()
     {
         $uid  = $this->addUser();
         $address = 'http://example.org';