summaryrefslogtreecommitdiff
path: root/tests/Bookmark2TagTest.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-03-25 07:44:07 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-03-25 07:44:07 +0100
commite667feb0ca9ff30a063149a2ce20b3398585dd4f (patch)
tree18a17453d4615a5683425f99b5d98d562a927d33 /tests/Bookmark2TagTest.php
parentd761abb05e28ef4f345acef739e3b371b462f9fe (diff)
downloadsemanticscuttle-e667feb0ca9ff30a063149a2ce20b3398585dd4f.tar.gz
semanticscuttle-e667feb0ca9ff30a063149a2ce20b3398585dd4f.tar.bz2
beginsWith-parameter for getPopulartags, getContactTags and getAdminTags
Diffstat (limited to 'tests/Bookmark2TagTest.php')
-rw-r--r--tests/Bookmark2TagTest.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php
index e2020dc..ffd83c3 100644
--- a/tests/Bookmark2TagTest.php
+++ b/tests/Bookmark2TagTest.php
@@ -334,6 +334,31 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'thr', 'bCount' => '2'), $arTags);
}
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getPopularTags
+ */
+ public function testGetPopularTagsBeginsWith()
+ {
+ $user = $this->addUser();
+ $this->addTagBookmark($user, array('one', 'two'));
+ $this->addTagBookmark($user, array('one', 'thr'));
+ $this->addTagBookmark($user, array('one', 'two'));
+ $this->addTagBookmark($user, array('one', 'thr'));
+
+ $arTags = $this->b2ts->getPopularTags(null, 10, null, null, 'o');
+ $this->assertEquals(1, count($arTags));
+ $this->assertContains(array('tag' => 'one', 'bCount' => '4'), $arTags);
+
+ $arTags = $this->b2ts->getPopularTags(null, 10, null, null, 'tw');
+ $this->assertEquals(1, count($arTags));
+ $this->assertContains(array('tag' => 'two', 'bCount' => '2'), $arTags);
+
+ $arTags = $this->b2ts->getPopularTags(null, 10, null, null, 't');
+ $this->assertEquals(2, count($arTags));
+ $this->assertContains(array('tag' => 'two', 'bCount' => '2'), $arTags);
+ $this->assertContains(array('tag' => 'thr', 'bCount' => '2'), $arTags);
+ }
+
/**
@@ -500,6 +525,23 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'admintag2', 'bCount' => '1'), $arTags);
}
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getAdminTags
+ */
+ public function testGetAdminTagsBeginsWith()
+ {
+ $admin1 = $this->addUser('admin1');
+ $this->addBookmark($admin1, null, 0, array('admintag', 'admintag1'));
+ $this->addBookmark($admin1, null, 0, array('tester', 'testos'));
+
+ $GLOBALS['admin_users'] = array('admin1');
+
+ $arTags = $this->b2ts->getAdminTags(4, null, null, 'test');
+ $this->assertEquals(2, count($arTags));
+ $this->assertContains(array('tag' => 'tester', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'testos', 'bCount' => '1'), $arTags);
+ }
+
/**
@@ -546,6 +588,28 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
$this->assertContains(array('tag' => 'usertag2', 'bCount' => '1'), $arTags);
}
+
+ /**
+ * @covers SemanticScuttle_Service_Bookmark2Tag::getContactTags
+ */
+ public function testGetContactTagsBeginsWith()
+ {
+ $user1 = $this->addUser();
+ $this->addBookmark($user1, null, 0, array('usertag', 'usertag1'));
+ $this->addBookmark($user1, null, 0, array('usable', 'undefined'));
+ $this->addBookmark($user1, null, 0, array('fußbad', 'usable'));
+
+ $arTags = $this->b2ts->getContactTags($user1, 10, $user1, null, 'user');
+ $this->assertEquals(2, count($arTags));
+ $this->assertContains(array('tag' => 'usertag', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
+
+ $arTags = $this->b2ts->getContactTags($user1, 10, $user1, null, 'us');
+ $this->assertEquals(3, count($arTags));
+ $this->assertContains(array('tag' => 'usertag', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
+ }
}
if (PHPUnit_MAIN_METHOD == 'Bookmark2TagTest::main') {