From cb28cd3371e215646765f6d1d06263a54a5526f1 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 23 Mar 2011 19:11:38 +0100 Subject: unittest for getAdminTags as well as CS and docblock fixes on it --- tests/Bookmark2TagTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/Bookmark2TagTest.php') diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php index a83a826..d85cf73 100644 --- a/tests/Bookmark2TagTest.php +++ b/tests/Bookmark2TagTest.php @@ -56,6 +56,7 @@ class Bookmark2TagTest extends TestBase protected function setUp() { $this->us = SemanticScuttle_Service_Factory::get('User'); + $this->us->deleteAll(); $this->bs = SemanticScuttle_Service_Factory::get('Bookmark'); $this->bs->deleteAll(); $this->b2ts= SemanticScuttle_Service_Factory::get('Bookmark2Tag'); @@ -447,6 +448,25 @@ class Bookmark2TagTest extends TestBase $this->assertContains(array('tag' => 'two', 'bCount' => '1'), $arTags); $this->assertContains(array('tag' => 'thr', 'bCount' => '1'), $arTags); } + + + public function testGetAdminTags() + { + $admin1 = $this->addUser('admin1'); + $admin2 = $this->addUser('admin2'); + $user1 = $this->addUser(); + $this->addBookmark($admin1, null, 0, array('admintag', 'admintag1')); + $this->addBookmark($admin2, null, 0, array('admintag', 'admintag2')); + $this->addBookmark($user1, null, 0, array('usertag')); + + $GLOBALS['admin_users'] = array('admin1', 'admin2'); + + $arTags = $this->b2ts->getAdminTags(4); + $this->assertEquals(3, count($arTags)); + $this->assertContains(array('tag' => 'admintag', 'bCount' => '2'), $arTags); + $this->assertContains(array('tag' => 'admintag1', 'bCount' => '1'), $arTags); + $this->assertContains(array('tag' => 'admintag2', 'bCount' => '1'), $arTags); + } } if (PHPUnit_MAIN_METHOD == 'Bookmark2TagTest::main') { -- cgit v1.2.3-54-g00ecf