diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 21:20:36 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 21:20:36 -0800 |
commit | e39c8df19fc0dadcfe65cb8a3ed6529648c6c9cf (patch) | |
tree | 93d84939d2ff6a7272308bba35809d80f8008148 /modules/gallery/tests | |
parent | 6aee6cde2519b125a3b1209d3a6cd441b5d3c526 (diff) |
Fix some validation checks to check to see if the original was loaded
before deciding whether or not we changed a value.
Change valid_name to be cascading, not parallel.
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index afb131fc..284491a0 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -320,9 +320,8 @@ class Item_Model_Test extends Unit_Test_Case { } public function slug_is_url_safe_test() { - $album = test::random_album_unsaved(); - try { + $album = test::random_album_unsaved(); $album->slug = "illegal chars! !@#@#$!@~"; $album->save(); $this->assert_true(false, "Shouldn't be able to save"); @@ -334,4 +333,17 @@ class Item_Model_Test extends Unit_Test_Case { $album->slug = "the_quick_brown_fox"; $album->save(); } + + public function cant_change_item_type_test() { + $photo = test::random_photo(); + try { + $photo->type = "movie"; + $photo->mime_type = "video/x-flv"; + $photo->save(); + } catch (ORM_Validation_Exception $e) { + $this->assert_same(array("type" => "read_only"), $e->validation->errors()); + return; // pass + } + $this->assert_true(false, "Shouldn't get here"); + } } |