enable voting when testing voting, test countBookmarks()
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@485 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
d1c4ef5043
commit
ac4e66c360
1 changed files with 85 additions and 0 deletions
|
@ -134,6 +134,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.
|
* Test if deleting a bookmark works.
|
||||||
*
|
*
|
||||||
|
@ -170,6 +245,8 @@ class BookmarkTest extends TestBase
|
||||||
*/
|
*/
|
||||||
public function testDeleteBookmarkWithVote()
|
public function testDeleteBookmarkWithVote()
|
||||||
{
|
{
|
||||||
|
$GLOBALS['enableVoting'] = true;
|
||||||
|
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$bid = $this->addBookmark();
|
$bid = $this->addBookmark();
|
||||||
|
|
||||||
|
@ -196,6 +273,8 @@ class BookmarkTest extends TestBase
|
||||||
*/
|
*/
|
||||||
public function testGetBookmarkUserVotingNoUser()
|
public function testGetBookmarkUserVotingNoUser()
|
||||||
{
|
{
|
||||||
|
$GLOBALS['enableVoting'] = true;
|
||||||
|
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$bid = $this->addBookmark($uid);
|
$bid = $this->addBookmark($uid);
|
||||||
//no user
|
//no user
|
||||||
|
@ -217,6 +296,8 @@ class BookmarkTest extends TestBase
|
||||||
*/
|
*/
|
||||||
public function testGetBookmarkUserVotingWithUserNoVote()
|
public function testGetBookmarkUserVotingWithUserNoVote()
|
||||||
{
|
{
|
||||||
|
$GLOBALS['enableVoting'] = true;
|
||||||
|
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$bid = $this->addBookmark($uid);
|
$bid = $this->addBookmark($uid);
|
||||||
//log user in
|
//log user in
|
||||||
|
@ -240,6 +321,8 @@ class BookmarkTest extends TestBase
|
||||||
*/
|
*/
|
||||||
public function testGetBookmarkUserVotingWithUserPositiveVote()
|
public function testGetBookmarkUserVotingWithUserPositiveVote()
|
||||||
{
|
{
|
||||||
|
$GLOBALS['enableVoting'] = true;
|
||||||
|
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$bid = $this->addBookmark($uid);
|
$bid = $this->addBookmark($uid);
|
||||||
//log user in
|
//log user in
|
||||||
|
@ -264,6 +347,8 @@ class BookmarkTest extends TestBase
|
||||||
*/
|
*/
|
||||||
public function testGetBookmarkUserVotingWithUserNegativeVote()
|
public function testGetBookmarkUserVotingWithUserNegativeVote()
|
||||||
{
|
{
|
||||||
|
$GLOBALS['enableVoting'] = true;
|
||||||
|
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$bid = $this->addBookmark($uid);
|
$bid = $this->addBookmark($uid);
|
||||||
//log user in
|
//log user in
|
||||||
|
|
Loading…
Reference in a new issue