diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/tests/Item_Rest_Helper_Test.php | 10 | ||||
-rw-r--r-- | modules/rest/libraries/Rest_Exception.php | 2 | ||||
-rw-r--r-- | modules/rest/views/error_rest.json.php (renamed from modules/rest/views/error_rest.php) | 0 | ||||
-rw-r--r-- | modules/tag/helpers/tags_rest.php | 10 | ||||
-rw-r--r-- | modules/tag/tests/Tags_Rest_Helper_Test.php | 2 |
5 files changed, 19 insertions, 5 deletions
diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php index 0b5e0471..a2ab534b 100644 --- a/modules/gallery/tests/Item_Rest_Helper_Test.php +++ b/modules/gallery/tests/Item_Rest_Helper_Test.php @@ -43,6 +43,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { array("url" => rest::url("item", $album1), "entity" => $album1->as_restful_array(), "relationships" => array( + "comments" => array( + "url" => rest::url("item_comments", $album1)), "tags" => array( "url" => rest::url("item_tags", $album1), "members" => array())), @@ -58,6 +60,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { array("url" => rest::url("item", $album1), "entity" => $album1->as_restful_array(), "relationships" => array( + "comments" => array( + "url" => rest::url("item_comments", $album1)), "tags" => array( "url" => rest::url("item_tags", $album1), "members" => array())), @@ -73,6 +77,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { array("url" => rest::url("item", $album1), "entity" => $album1->as_restful_array(), "relationships" => array( + "comments" => array( + "url" => rest::url("item_comments", $album1)), "tags" => array( "url" => rest::url("item_tags", $album1), "members" => array())), @@ -100,6 +106,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { array("url" => rest::url("item", $album1), "entity" => $album1->as_restful_array(), "relationships" => array( + "comments" => array( + "url" => rest::url("item_comments", $album1)), "tags" => array( "url" => rest::url("item_tags", $album1), "members" => array())), @@ -123,6 +131,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { array("url" => rest::url("item", $album1), "entity" => $album1->as_restful_array(), "relationships" => array( + "comments" => array( + "url" => rest::url("item_comments", $album1)), "tags" => array( "url" => rest::url("item_tags", $album1), "members" => array())), diff --git a/modules/rest/libraries/Rest_Exception.php b/modules/rest/libraries/Rest_Exception.php index 1257e3cf..087da939 100644 --- a/modules/rest/libraries/Rest_Exception.php +++ b/modules/rest/libraries/Rest_Exception.php @@ -32,6 +32,6 @@ class Rest_Exception_Core extends Kohana_Exception { } public function getTemplate() { - return "error_rest"; + return "error_rest.json"; } }
\ No newline at end of file diff --git a/modules/rest/views/error_rest.php b/modules/rest/views/error_rest.json.php index c018378e..c018378e 100644 --- a/modules/rest/views/error_rest.php +++ b/modules/rest/views/error_rest.json.php diff --git a/modules/tag/helpers/tags_rest.php b/modules/tag/helpers/tags_rest.php index 975cf140..4f40e7f4 100644 --- a/modules/tag/helpers/tags_rest.php +++ b/modules/tag/helpers/tags_rest.php @@ -29,9 +29,13 @@ class tags_rest_Core { static function get($request) { $tags = array(); - $p = $request->params; - $num = isset($p->num) ? min((int)$p->num, 100) : 10; - $start = isset($p->start) ? (int)$p->start : 0; + $num = 10; + $start = 0; + if (isset($request->params)) { + $p = $request->params; + $num = isset($p->num) ? min((int)$p->num, 100) : 10; + $start = isset($p->start) ? (int)$p->start : 0; + } foreach (ORM::factory("tag")->find_all($num, $start) as $tag) { $tags[] = rest::url("tag", $tag); diff --git a/modules/tag/tests/Tags_Rest_Helper_Test.php b/modules/tag/tests/Tags_Rest_Helper_Test.php index 99332c7c..1b909e50 100644 --- a/modules/tag/tests/Tags_Rest_Helper_Test.php +++ b/modules/tag/tests/Tags_Rest_Helper_Test.php @@ -45,7 +45,7 @@ class Tags_Rest_Helper_Test extends Gallery_Unit_Test_Case { } public function post_test() { - identity::set_active_user(identity::guest()); + identity::set_active_user(identity::admin_user()); $request = new stdClass(); $request->params = new stdClass(); |