aboutsummaryrefslogtreecommitdiff
path: root/tests/Bookmark2TagTest.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-03-24 08:36:54 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-03-24 08:36:54 +0100
commit637e276ac7dc0e9acdbb79ed68415c1770ce7a3f (patch)
tree4778da56a0e98a2c5c176670a38ca88e50d41c9f /tests/Bookmark2TagTest.php
parentcb28cd3371e215646765f6d1d06263a54a5526f1 (diff)
downloadsemanticscuttle-637e276ac7dc0e9acdbb79ed68415c1770ce7a3f.tar.gz
semanticscuttle-637e276ac7dc0e9acdbb79ed68415c1770ce7a3f.tar.bz2
unittest for Bookmark2Tag::getContactTags, CS and docblock
Diffstat (limited to 'tests/Bookmark2TagTest.php')
-rw-r--r--tests/Bookmark2TagTest.php62
1 files changed, 56 insertions, 6 deletions
diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php
index d85cf73..ad64bf6 100644
--- a/tests/Bookmark2TagTest.php
+++ b/tests/Bookmark2TagTest.php
@@ -74,7 +74,7 @@ class Bookmark2TagTest extends TestBase
/**
* Test getTagsForBookmark() when the bookmark has no tags
*
- * @return void
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getTagsForBookmark
*/
public function testGetTagsForBookmarkNone()
{
@@ -92,7 +92,7 @@ class Bookmark2TagTest extends TestBase
/**
* Test getTagsForBookmark() when the bookmark has one tag
*
- * @return void
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getTagsForBookmark
*/
public function testGetTagsForBookmarkOne()
{
@@ -109,9 +109,9 @@ class Bookmark2TagTest extends TestBase
/**
- * Test getTagsForBookmark() when the bookmark has thr tags
+ * Test getTagsForBookmark() when the bookmark has three tags
*
- * @return void
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getTagsForBookmark
*/
public function testGetTagsForBookmarkThr()
{
@@ -132,7 +132,7 @@ class Bookmark2TagTest extends TestBase
/**
* Test getTagsForBookmarks() when no bookmarks have tags.
*
- * @return void
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getTagsForBookmarks
*/
public function testGetTagsForBookmarksNone()
{
@@ -155,7 +155,7 @@ class Bookmark2TagTest extends TestBase
/**
* Test getTagsForBookmarks() when most bookmarks have tags.
*
- * @return void
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getTagsForBookmarks
*/
public function testGetTagsForBookmarksMost()
{
@@ -450,6 +450,9 @@ class Bookmark2TagTest extends TestBase
}
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getAdminTags
+ */
public function testGetAdminTags()
{
$admin1 = $this->addUser('admin1');
@@ -467,6 +470,53 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'admintag1', 'bCount' => '1'), $arTags);
$this->assertContains(array('tag' => 'admintag2', 'bCount' => '1'), $arTags);
}
+
+
+
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getContactTags
+ */
+ public function testGetContactTagsWatchlistOnly()
+ {
+ $user1 = $this->addUser();
+ $user2 = $this->addUser();
+ $user3 = $this->addUser();
+ $this->us->setCurrentUserId($user1);
+ $this->us->setWatchStatus($user2);
+ //user1 watches user2 now
+
+ $this->addBookmark($user1, null, 0, array('usertag', 'usertag1'));
+ $this->addBookmark($user2, null, 0, array('usertag', 'usertag2'));
+ $this->addBookmark($user3, null, 0, array('usertag', 'usertag3'));
+
+ $arTags = $this->b2ts->getContactTags($user1, 10);
+ $this->assertEquals(2, count($arTags));
+ $this->assertContains(array('tag' => 'usertag', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'usertag2', 'bCount' => '1'), $arTags);
+ }
+
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getContactTags
+ */
+ public function testGetContactTagsIncludingUser()
+ {
+ $user1 = $this->addUser();
+ $user2 = $this->addUser();
+ $user3 = $this->addUser();
+ $this->us->setCurrentUserId($user1);
+ $this->us->setWatchStatus($user2);
+ //user1 watches user2 now
+
+ $this->addBookmark($user1, null, 0, array('usertag', 'usertag1'));
+ $this->addBookmark($user2, null, 0, array('usertag', 'usertag2'));
+ $this->addBookmark($user3, null, 0, array('usertag', 'usertag3'));
+
+ $arTags = $this->b2ts->getContactTags($user1, 10, $user1);
+ $this->assertEquals(3, count($arTags));
+ $this->assertContains(array('tag' => 'usertag', 'bCount' => '2'), $arTags);
+ $this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'usertag2', 'bCount' => '1'), $arTags);
+ }
}
if (PHPUnit_MAIN_METHOD == 'Bookmark2TagTest::main') {