From 4418993db96a6d9c4444957b78588b4ce01556f4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 18 Jan 2010 23:38:39 -0800 Subject: Add slug_is_url_safe_test() --- modules/gallery/tests/Item_Model_Test.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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(); + } } -- cgit v1.2.3