diff --git a/lib/bookmarks.php b/lib/bookmarks.php index 97082bfa..fc2f2311 100644 --- a/lib/bookmarks.php +++ b/lib/bookmarks.php @@ -27,6 +27,9 @@ class OC_Bookmarks_Bookmarks{ /** * @brief Finds all tags for bookmarks + * @param filterTags array of tag to look for if empty then every tag + * @param offset result offset + * @param limit number of item to return */ public static function findTags($filterTags = array(), $offset = 0, $limit = 10){ $params = array_merge($filterTags, $filterTags); diff --git a/tests/lib_bookmark.php b/tests/lib_bookmark.php new file mode 100644 index 00000000..219070a9 --- /dev/null +++ b/tests/lib_bookmark.php @@ -0,0 +1,27 @@ +assertCount(0, OC_Bookmarks_Bookmarks::findBookmarks(0, 'id', array(), true, -1)); + OC_Bookmarks_Bookmarks::addBookmark( + 'http://owncloud.org', 'Owncloud project', array('oc', 'cloud'), 'An Awesome project'); + $this->assertCount(1, OC_Bookmarks_Bookmarks::findBookmarks(0, 'id', array(), true, -1)); + } + + function testFindTags() { + $uid=uniqid(); + $this->assertEqual(OC_Bookmarks_Bookmarks::findTags(), array()); + + OC_Bookmarks_Bookmarks::addBookmark( + 'http://owncloud.org', 'Owncloud project', array('oc', 'cloud'), 'An Awesome project'); + $this->assertEqual(array(0=>array('tag' => 'cloud', 'nbr'=>1), 1=>array('tag' => 'oc', 'nbr'=>1)), + OC_Bookmarks_Bookmarks::findTags()); + } + + protected function tearDown() { + $query = OC_DB::prepare('DELETE FROM *PREFIX*bookmarks WHERE `user_id` = \'\' '); + $query->execute(); + } + +} \ No newline at end of file