diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-02-20 11:07:37 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-02-20 11:07:37 +0000 |
commit | 46b96044fb2375d4b522fa074788199d80b4d243 (patch) | |
tree | 2da16729918ca19452a0eae8539d47146f907d1b /tests/BookmarkTest.php | |
parent | fe522e57197133d3a4a09425bf2067418a6f3c7c (diff) | |
download | semanticscuttle-46b96044fb2375d4b522fa074788199d80b4d243.tar.gz semanticscuttle-46b96044fb2375d4b522fa074788199d80b4d243.tar.bz2 |
test getBookmarks() with tag loading functionality
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@662 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r-- | tests/BookmarkTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 69e6e8a..39a9974 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -332,6 +332,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. * * @return void |