The hasTag was always returning false, which probably is a bug. Fixed it and added a test to catch it. Thanks for Ricardo Soares de Lima for the first patch version
This commit is contained in:
parent
20e3b5ebd7
commit
26352761d3
@ -626,12 +626,13 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output = false;
|
||||||
if ($row = $this->db->sql_fetchrow($dbresult)) {
|
if ($row = $this->db->sql_fetchrow($dbresult)) {
|
||||||
if ($row['tCount'] > 0) {
|
if ($row['tCount'] > 0) {
|
||||||
$output = true;
|
$output = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$output = false;
|
|
||||||
$this->db->sql_freeresult($dbresult);
|
$this->db->sql_freeresult($dbresult);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class Bookmark2TagTest extends TestBase
|
|||||||
$this->b2ts->getTagsForBookmark($bid, true)
|
$this->b2ts->getTagsForBookmark($bid, true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAttachTagsWithEmptyStringAddsSystemUnfiled()
|
public function testAttachTagsWithEmptyStringAddsSystemUnfiled()
|
||||||
{
|
{
|
||||||
$originalDisplayErros = ini_get('display_errors');
|
$originalDisplayErros = ini_get('display_errors');
|
||||||
@ -582,7 +582,7 @@ class Bookmark2TagTest extends TestBase
|
|||||||
$this->addBookmark($user1, null, 0, array('usertag'));
|
$this->addBookmark($user1, null, 0, array('usertag'));
|
||||||
|
|
||||||
$GLOBALS['admin_users'] = array('admin1', 'admin2');
|
$GLOBALS['admin_users'] = array('admin1', 'admin2');
|
||||||
|
|
||||||
$arTags = $this->b2ts->getAdminTags(4);
|
$arTags = $this->b2ts->getAdminTags(4);
|
||||||
$this->assertEquals(3, count($arTags));
|
$this->assertEquals(3, count($arTags));
|
||||||
$this->assertContains(array('tag' => 'admintag', 'bCount' => '2'), $arTags);
|
$this->assertContains(array('tag' => 'admintag', 'bCount' => '2'), $arTags);
|
||||||
@ -600,7 +600,7 @@ class Bookmark2TagTest extends TestBase
|
|||||||
$this->addBookmark($admin1, null, 0, array('tester', 'testos'));
|
$this->addBookmark($admin1, null, 0, array('tester', 'testos'));
|
||||||
|
|
||||||
$GLOBALS['admin_users'] = array('admin1');
|
$GLOBALS['admin_users'] = array('admin1');
|
||||||
|
|
||||||
$arTags = $this->b2ts->getAdminTags(4, null, null, 'test');
|
$arTags = $this->b2ts->getAdminTags(4, null, null, 'test');
|
||||||
$this->assertEquals(2, count($arTags));
|
$this->assertEquals(2, count($arTags));
|
||||||
$this->assertContains(array('tag' => 'tester', 'bCount' => '1'), $arTags);
|
$this->assertContains(array('tag' => 'tester', 'bCount' => '1'), $arTags);
|
||||||
@ -675,5 +675,14 @@ class Bookmark2TagTest extends TestBase
|
|||||||
$this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
|
$this->assertContains(array('tag' => 'usertag1', 'bCount' => '1'), $arTags);
|
||||||
$this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
|
$this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHasTag()
|
||||||
|
{
|
||||||
|
$bid = $this->addBookmark(null, null, 0, array('foo'));
|
||||||
|
|
||||||
|
$this->assertTrue($this->b2ts->hasTag($bid, 'foo'));
|
||||||
|
$this->assertFalse($this->b2ts->hasTag($bid, 'bar'));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user