summaryrefslogtreecommitdiff
path: root/modules/comment/tests/Comment_Model_Test.php
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-07-08 00:29:37 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-07-08 00:29:37 +0000
commitc83650d83ad8b1f4bda30cac2ae8efa6e1c97287 (patch)
tree482cf980e87cd7c80c28a89bb9395eba6b53026f /modules/comment/tests/Comment_Model_Test.php
parenta0b0b415515bff5f9edd43d373e8e78f3b3f8e4d (diff)
parent9d66783f47636153bf3661d1d89e694dd5188c36 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/comment/tests/Comment_Model_Test.php')
-rw-r--r--modules/comment/tests/Comment_Model_Test.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/comment/tests/Comment_Model_Test.php b/modules/comment/tests/Comment_Model_Test.php
index f4e944f0..ee4d3d3c 100644
--- a/modules/comment/tests/Comment_Model_Test.php
+++ b/modules/comment/tests/Comment_Model_Test.php
@@ -22,6 +22,37 @@ class Comment_Model_Test extends Gallery_Unit_Test_Case {
identity::set_active_user(identity::admin_user());
}
+ public function guest_name_and_email_is_required_test() {
+ try {
+ $comment = ORM::factory("comment");
+ $comment->item_id = item::root()->id;
+ $comment->author_id = identity::guest()->id;
+ $comment->text = "text";
+ $comment->save();
+ } catch (ORM_Validation_Exception $e) {
+ $this->assert_equal(array("guest_name" => "required",
+ "guest_email" => "required"),
+ $e->validation->errors());
+ return;
+ }
+ }
+
+ public function guest_email_must_be_well_formed_test() {
+ try {
+ $comment = ORM::factory("comment");
+ $comment->item_id = item::root()->id;
+ $comment->author_id = identity::guest()->id;
+ $comment->guest_name = "guest";
+ $comment->guest_email = "bogus";
+ $comment->text = "text";
+ $comment->save();
+ } catch (ORM_Validation_Exception $e) {
+ $this->assert_equal(array("guest_email" => "invalid"),
+ $e->validation->errors());
+ return;
+ }
+ }
+
public function cant_view_comments_for_unviewable_items_test() {
$album = test::random_album();