summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-27 21:40:48 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-27 21:40:48 -0800
commitec0f89f10a58c3c3751387d5c1d1efcbf940bc9a (patch)
tree2463e384b8365dee6876e610354bd7b23d8071de /modules/gallery
parent4ca91bf6188a1a034ef7770308f42e7c788a1936 (diff)
Change "resource" to "entity" in REST responses. They're all
resources, but we differentiate resources as collections and entities.
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/helpers/item_rest.php2
-rw-r--r--modules/gallery/tests/Item_Rest_Helper_Test.php11
2 files changed, 7 insertions, 6 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index 9598b191..2236fbbb 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -77,7 +77,7 @@ class item_rest_Core {
return array(
"url" => $request->url,
- "resource" => $item->as_array(),
+ "entity" => $item->as_array(),
"members" => $members,
"relationships" => rest::relationships("item", $item));
}
diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php
index 8ce6bc43..d91e0f58 100644
--- a/modules/gallery/tests/Item_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Item_Rest_Helper_Test.php
@@ -36,7 +36,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$request->params = new stdClass();
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
- "resource" => $album1->as_array(),
+ "entity" => $album1->as_array(),
"members" => array(
rest::url("item", $photo1),
rest::url("item", $album2)),
@@ -50,7 +50,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$request->params->scope = "direct";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
- "resource" => $album1->as_array(),
+ "entity" => $album1->as_array(),
"members" => array(
rest::url("item", $photo1),
rest::url("item", $album2)),
@@ -64,7 +64,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$request->params->scope = "all";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
- "resource" => $album1->as_array(),
+ "entity" => $album1->as_array(),
"members" => array(
rest::url("item", $photo1),
rest::url("item", $album2),
@@ -88,7 +88,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$request->params->name = "foo";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
- "resource" => $album1->as_array(),
+ "entity" => $album1->as_array(),
"members" => array(
rest::url("item", $photo2)),
"relationships" => array(
@@ -108,7 +108,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$request->params->type = "album";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
- "resource" => $album1->as_array(),
+ "entity" => $album1->as_array(),
"members" => array(
rest::url("item", $album2)),
"relationships" => array(
@@ -210,6 +210,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
public function delete_album_fails_without_permission_test() {
$album1 = test::random_album();
access::deny(identity::everybody(), "edit", $album1);
+ identity::set_active_user(identity::guest());
$request->url = rest::url("item", $album1);
try {