diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-11-19 19:24:34 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-11-19 19:24:34 +0000 |
commit | 7a495ede9d122afec778890dbf824d56c5058ade (patch) | |
tree | 2d57381cd83e426c0c6e256e72f7063e8f4e092e /tests/BookmarkTest.php | |
parent | 9710ede4327a4dcacec1715cb4451365474297e5 (diff) | |
download | semanticscuttle-7a495ede9d122afec778890dbf824d56c5058ade.tar.gz semanticscuttle-7a495ede9d122afec778890dbf824d56c5058ade.tar.bz2 |
fully test editAllowed()
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@560 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r-- | tests/BookmarkTest.php | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index f54b9e5..caee84b 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -295,7 +295,7 @@ class BookmarkTest extends TestBase public function testEditAllowedBookmarkId() { $uid = $this->addUser(); - $bid = $this->addBookmark(); + $bid = $this->addBookmark($uid); $this->us->setCurrentUserId($uid); $this->assertTrue($this->bs->editAllowed($bid)); } @@ -303,6 +303,39 @@ class BookmarkTest extends TestBase /** + * Test if editAllowed() works when passing the ID of + * an existing bookmark that does not belong to the current + * user. + * + * @return void + */ + public function testEditAllowedBookmarkIdNotOwn() + { + $uid = $this->addUser(); + $bid = $this->addBookmark(); + $this->us->setCurrentUserId($uid); + $this->assertFalse($this->bs->editAllowed($bid)); + } + + + + /** + * Test if editAllowed() works when passing the ID of + * an existing bookmark that does not belong to the current + * user. + * + * @return void + */ + public function testEditAllowedBookmarkIdNoUser() + { + $bid = $this->addBookmark(); + $this->us->setCurrentUserId(null); + $this->assertFalse($this->bs->editAllowed($bid)); + } + + + + /** * Test if editAllowed() works when passing a bookmark * row. * @@ -310,6 +343,12 @@ class BookmarkTest extends TestBase */ public function testEditAllowedBookmarkRow() { + $uid = $this->addUser(); + $this->us->setCurrentUserId($uid); + + $bid = $this->addBookmark($uid); + $bookmark = $this->bs->getBookmark($bid); + $this->assertTrue($this->bs->editAllowed($bookmark)); } @@ -328,6 +367,25 @@ class BookmarkTest extends TestBase /** + * Test if editAllowed() works when the user is an administrator. + * + * @return void + */ + public function testEditAllowedBookmarkAdmin() + { + //make the user admin + $uid = $this->addUser(); + $user = $this->us->getUser($uid); + $GLOBALS['admin_users'][] = $user['username']; + + $bid = $this->addBookmark($uid); + $this->us->setCurrentUserId($uid); + $this->assertTrue($this->bs->editAllowed($bid)); + } + + + + /** * Verify that getBookmark() returns false when the * bookmark cannot be found. * |