summaryrefslogtreecommitdiff
path: root/core/tests
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-13 19:49:33 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-13 19:49:33 +0000
commit8ba5ea3cf832f42e93e98c3b984962ace3abf2d1 (patch)
treead44d2124cb4ae3f898cc4df2e6f45751805ac8d /core/tests
parent65e237a59a99d7c5e8c32cdc7c730414f6dea30f (diff)
Make sure that access::can fails if the item is not loaded
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Access_Helper_Test.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php
index a8e48832..7f5aa656 100644
--- a/core/tests/Access_Helper_Test.php
+++ b/core/tests/Access_Helper_Test.php
@@ -127,6 +127,15 @@ class Access_Helper_Test extends Unit_Test_Case {
$this->assert_true(access::group_can(group::everybody(), "view", $root));
}
+ public function can_always_fails_on_unloaded_items_test() {
+ $root = ORM::factory("item", 1);
+ access::allow(group::everybody(), "view", $root);
+ $this->assert_true(access::group_can(group::everybody(), "view", $root));
+
+ $bogus = ORM::factory("item", -1);
+ $this->assert_false(access::group_can(group::everybody(), "view", $bogus));
+ }
+
public function cant_view_child_of_hidden_parent_test() {
$root = ORM::factory("item", 1);
$album = ORM::factory("item")->add_to_parent($root);