diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 23:38:39 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 23:38:39 -0800 |
commit | 4418993db96a6d9c4444957b78588b4ce01556f4 (patch) | |
tree | 363c3621582535a6cfe6749be1da7e04cedeb019 /modules | |
parent | 2687762aec243d157f38de765f4b5c8465fc23ec (diff) |
Add slug_is_url_safe_test()
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 5294836d..afb131fc 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -318,4 +318,20 @@ class Item_Model_Test extends Unit_Test_Case { $this->assert_false(true, "Shouldn't get here"); } + + public function slug_is_url_safe_test() { + $album = test::random_album_unsaved(); + + try { + $album->slug = "illegal chars! !@#@#$!@~"; + $album->save(); + $this->assert_true(false, "Shouldn't be able to save"); + } catch (ORM_Validation_Exception $e) { + $this->assert_same(array("slug" => "not_url_safe"), $e->validation->errors()); + } + + // This should work + $album->slug = "the_quick_brown_fox"; + $album->save(); + } } |