summaryrefslogtreecommitdiff
path: root/modules/gallery/tests/Item_Model_Test.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/tests/Item_Model_Test.php')
-rw-r--r--modules/gallery/tests/Item_Model_Test.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index 15aa2d8c..6c5882c4 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -357,13 +357,25 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$photo = test::random_photo($album);
$album->reload();
- $result = $album->as_restful_array();
+ $result = $album->as_restful_array(false);
$this->assert_same(rest::url("item", item::root()), $result["parent"]);
$this->assert_same(rest::url("item", $photo), $result["album_cover"]);
$this->assert_true(!array_key_exists("parent_id", $result));
$this->assert_true(!array_key_exists("album_cover_item_id", $result));
}
+ public function as_restful_array_with_ids_test() {
+ $album = test::random_album();
+ $photo = test::random_photo($album);
+ $album->reload();
+
+ $result = $album->as_restful_array(true);
+ $this->assert_same(item::root()->id, $result["parent_id"]);
+ $this->assert_same($photo->id, $result["album_cover_item_id"]);
+ $this->assert_true(!array_key_exists("parent", $result));
+ $this->assert_true(!array_key_exists("album_cover_item", $result));
+ }
+
public function first_photo_becomes_album_cover() {
$album = test::random_album();
$photo = test::random_photo($album);