summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-01-23 18:24:31 -0500
committerBharat Mediratta <bharat@menalto.com>2013-01-23 18:24:31 -0500
commit9ba9f3953132c5c5de9efb0a4724c7b9300dc9ea (patch)
tree4360e6154895c58144a9a03e3081f4d2650d479c /modules/gallery/tests
parent31807a59a5160a816718fbea1b1659398a2110bb (diff)
Add a "can_add" permission bit similar to the "can_edit" bit to the RESTful array
representation of Item_Model. Fixes #1903.
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/Item_Model_Test.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index dc4432a6..a7eba1ad 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -399,7 +399,16 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_false($response["can_edit"]);
}
- public function first_photo_becomes_album_cover() {
+ public function as_restful_array_with_add_bit_test() {
+ $response = item::root()->as_restful_array();
+ $this->assert_true($response["can_add"]);
+
+ identity::set_active_user(identity::guest());
+ $response = item::root()->as_restful_array();
+ $this->assert_false($response["can_add"]);
+ }
+
+ public function first_photo_becomes_album_cover_test() {
$album = test::random_album();
$photo = test::random_photo($album);
$album->reload();