diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-15 23:36:52 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-15 23:36:52 -0700 |
commit | 29a8ba959ec1ec1ebd14d12c2a102fd7d3fcd012 (patch) | |
tree | d1f75ca29e54e1df32d1d5589ec27b676ca092b4 /modules/comment/tests/Comment_Model_Test.php | |
parent | 28aee011307e37cd80e9bef0f08cb9b0270d89b5 (diff) | |
parent | 1240878df0f4a2b0ad0cdb32814717038ff2773f (diff) |
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/comment/tests/Comment_Model_Test.php')
-rw-r--r-- | modules/comment/tests/Comment_Model_Test.php | 31 |
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(); |