diff options
| author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-11-20 17:38:15 +0000 | 
|---|---|---|
| committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-11-20 17:38:15 +0000 | 
| commit | 1256489fa7a3afa0663c9892adcdb6096499c3dc (patch) | |
| tree | aace3573c3526a4f39a8fec2c7914bd58c0bfaa0 /tests/BookmarkTest.php | |
| parent | 258fc8edc5921a2511f871603f84405881c9d706 (diff) | |
| download | semanticscuttle-1256489fa7a3afa0663c9892adcdb6096499c3dc.tar.gz semanticscuttle-1256489fa7a3afa0663c9892adcdb6096499c3dc.tar.bz2 | |
test deleteBookmarksForUser
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@565 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
| -rw-r--r-- | tests/BookmarkTest.php | 53 | 
1 files changed, 53 insertions, 0 deletions
| diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index f7d8ead..0b47bc2 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -343,6 +343,59 @@ class BookmarkTest extends TestBase      /** +     * Test if deleting all bookmarks for a user works. +     * +     * @return void +     */ +    public function testDeleteBookmarksForUser() +    { +        $uid = $this->addUser(); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(0, $bookmarks['total']); + +        $this->addBookmark($uid); +        $this->addBookmark($uid); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(2, $bookmarks['total']); + +        $this->bs->deleteBookmarksForUser($uid); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(0, $bookmarks['total']); +    } + + + +    /** +     * Test if deleting all bookmarks for a user works +     * and does not damage other user's bookmarks. +     * +     * @return void +     */ +    public function testDeleteBookmarksForUserOthers() +    { +        $uidOther = $this->addUser(); +        $this->addBookmark($uidOther); + +        $uid = $this->addUser(); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(0, $bookmarks['total']); + +        $this->addBookmark($uid); +        $this->addBookmark($uid); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(2, $bookmarks['total']); + +        $this->bs->deleteBookmarksForUser($uid); +        $bookmarks = $this->bs->getBookmarks(0, null, $uid); +        $this->assertEquals(0, $bookmarks['total']); + +        $bookmarks = $this->bs->getBookmarks(0, null, $uidOther); +        $this->assertEquals(1, $bookmarks['total']); +    } + + + +    /**       * Test if deleting a bookmark with a vote works.       *       * @return void | 
