add more countother-watchlist tests that are simpler than the previous test
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@736 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
930cfd784a
commit
17a1595b31
1 changed files with 87 additions and 1 deletions
|
@ -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
|
* Test what countOther() returns when the user is logged in
|
||||||
* and friends (people on the watchlist) have bookmarked
|
* and friends (people on the watchlist) have bookmarked
|
||||||
|
@ -1092,7 +1178,7 @@ class BookmarkTest extends TestBase
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCountOthersWatchlist()
|
public function testCountOthersWatchlistComplex()
|
||||||
{
|
{
|
||||||
$uid = $this->addUser();
|
$uid = $this->addUser();
|
||||||
$address = 'http://example.org';
|
$address = 'http://example.org';
|
||||||
|
|
Loading…
Reference in a new issue