diff options
| author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-31 10:19:38 +0000 | 
|---|---|---|
| committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-31 10:19:38 +0000 | 
| commit | ac4e66c360ce83fe13f00af99fbfad8a80b80e1f (patch) | |
| tree | 067dbf41acf3d9477fc94c10bd2a35f60a344e61 /tests | |
| parent | d1c4ef504360063936f767c7ab6c251c97c3f41f (diff) | |
| download | semanticscuttle-ac4e66c360ce83fe13f00af99fbfad8a80b80e1f.tar.gz semanticscuttle-ac4e66c360ce83fe13f00af99fbfad8a80b80e1f.tar.bz2  | |
enable voting when testing voting, test countBookmarks()
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@485 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/BookmarkTest.php | 85 | 
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 01e6b38..dbb4172 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -135,6 +135,81 @@ class BookmarkTest extends TestBase      /** +     * Test if countBookmarks() works with no bookmarks +     * +     * @return void +     */ +    public function testCountBookmarksNone() +    { +        $uid = $this->addUser(); +        $this->assertEquals(0, $this->bs->countBookmarks($uid)); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'public')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'private')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared')); +    } + + + +    /** +     * Test if countBookmarks() works with one public bookmark +     * +     * @return void +     */ +    public function testCountBookmarksOnePublic() +    { +        $uid = $this->addUser(); +        $this->addBookmark($uid); +        $this->assertEquals(1, $this->bs->countBookmarks($uid)); +        $this->assertEquals(1, $this->bs->countBookmarks($uid, 'public')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'private')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared')); +    } + + + +    /** +     * Test if countBookmarks() works with one private bookmark +     * +     * @return void +     */ +    public function testCountBookmarksOnePrivate() +    { +        $uid = $this->addUser(); +        $this->bs->addBookmark( +            'http://test', 'test', 'desc', 'note', +            2,//private +            array(), null, false, false, $uid +        ); +        $this->assertEquals(0, $this->bs->countBookmarks($uid)); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'public')); +        $this->assertEquals(1, $this->bs->countBookmarks($uid, 'private')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'shared')); +    } + + + +    /** +     * Test if countBookmarks() works with one shared bookmark +     * +     * @return void +     */ +    public function testCountBookmarksOneShared() +    { +        $uid = $this->addUser(); +        $this->bs->addBookmark( +            'http://test', 'test', 'desc', 'note', +            1,//shared +            array(), null, false, false, $uid +        ); +        $this->assertEquals(0, $this->bs->countBookmarks($uid)); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'public')); +        $this->assertEquals(0, $this->bs->countBookmarks($uid, 'private')); +        $this->assertEquals(1, $this->bs->countBookmarks($uid, 'shared')); +    } + + + +    /**       * Test if deleting a bookmark works.       *       * @return void @@ -170,6 +245,8 @@ class BookmarkTest extends TestBase       */      public function testDeleteBookmarkWithVote()      { +        $GLOBALS['enableVoting'] = true; +          $uid = $this->addUser();          $bid = $this->addBookmark(); @@ -196,6 +273,8 @@ class BookmarkTest extends TestBase       */      public function testGetBookmarkUserVotingNoUser()      { +        $GLOBALS['enableVoting'] = true; +          $uid = $this->addUser();          $bid = $this->addBookmark($uid);          //no user @@ -217,6 +296,8 @@ class BookmarkTest extends TestBase       */      public function testGetBookmarkUserVotingWithUserNoVote()      { +        $GLOBALS['enableVoting'] = true; +          $uid = $this->addUser();          $bid = $this->addBookmark($uid);          //log user in @@ -240,6 +321,8 @@ class BookmarkTest extends TestBase       */      public function testGetBookmarkUserVotingWithUserPositiveVote()      { +        $GLOBALS['enableVoting'] = true; +          $uid = $this->addUser();          $bid = $this->addBookmark($uid);          //log user in @@ -264,6 +347,8 @@ class BookmarkTest extends TestBase       */      public function testGetBookmarkUserVotingWithUserNegativeVote()      { +        $GLOBALS['enableVoting'] = true; +          $uid = $this->addUser();          $bid = $this->addBookmark($uid);          //log user in  | 
