test getBookmarks() with tag loading functionality
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@662 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
fe522e5719
commit
46b96044fb
1 changed files with 34 additions and 0 deletions
|
@ -331,6 +331,40 @@ class BookmarkTest extends TestBase
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Check tag loading functionality of getBookmarks()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetBookmarksIncludeTags()
|
||||
{
|
||||
$uid = $this->addUser();
|
||||
$bid = $this->addBookmark($uid);
|
||||
$this->b2ts->attachTags($bid, array('foo', 'bar'));
|
||||
$bid2 = $this->addBookmark($uid);
|
||||
$this->b2ts->attachTags($bid2, array('fuu', 'baz'));
|
||||
|
||||
$bms = $this->bs->getBookmarks();
|
||||
$this->assertEquals(2, count($bms['bookmarks']));
|
||||
$this->assertEquals(2, $bms['total']);
|
||||
|
||||
foreach ($bms['bookmarks'] as $bm) {
|
||||
$this->assertArrayHasKey('tags', $bm);
|
||||
$this->assertType('array', $bm['tags']);
|
||||
if ($bm['bId'] == $bid) {
|
||||
$this->assertContains('foo', $bm['tags']);
|
||||
$this->assertContains('bar', $bm['tags']);
|
||||
} else if ($bm['bId'] == $bid2) {
|
||||
$this->assertContains('fuu', $bm['tags']);
|
||||
$this->assertContains('baz', $bm['tags']);
|
||||
} else {
|
||||
$this->assertTrue(false, 'Unknown bookmark id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if deleting a bookmark works.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue