From cd1fd4989f394f6e8084b8101a8dbdb3030c52aa Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 12:22:00 -0700 Subject: [PATCH] Add a test for Comment_Model::viewable(). --- modules/comment/tests/Comment_Model_Test.php | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 modules/comment/tests/Comment_Model_Test.php diff --git a/modules/comment/tests/Comment_Model_Test.php b/modules/comment/tests/Comment_Model_Test.php new file mode 100644 index 0000000000..f4c68b150d --- /dev/null +++ b/modules/comment/tests/Comment_Model_Test.php @@ -0,0 +1,40 @@ +assert_equal( + 1, + ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all()); + + // We can't see the comment when permissions are denied on the album + access::deny(group::everybody(), "view", $album); + $this->assert_equal( + 0, + ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all()); + } +}