From 46b96044fb2375d4b522fa074788199d80b4d243 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 20 Feb 2010 11:07:37 +0000 Subject: test getBookmarks() with tag loading functionality git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@662 b3834d28-1941-0410-a4f8-b48e95affb8f --- tests/BookmarkTest.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/BookmarkTest.php') diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 69e6e8a..39a9974 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -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. * -- cgit v1.2.3