]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
test getBookmarks() with tag loading functionality
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:07:37 +0000 (11:07 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:07:37 +0000 (11:07 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@662 b3834d28-1941-0410-a4f8-b48e95affb8f

tests/BookmarkTest.php

index 69e6e8aaef3831598b8dd9d7b1b14d9e25208a1a..39a99740a5aeb5d230c54ea0f44c6ba8fa1adf3d 100644 (file)
@@ -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.
      *