diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 23:38:18 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 23:38:18 -0800 |
commit | 2687762aec243d157f38de765f4b5c8465fc23ec (patch) | |
tree | fd32486dfc7d4a667a7dca931d32ce831193884a /modules | |
parent | e06ceebaa6b9631ce27939beae477e684f949352 (diff) |
Update for model validation. Move the url safe tests into Item_Model_Test.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/tests/Item_Helper_Test.php | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php index f0c653c0..b3896c7a 100644 --- a/modules/gallery/tests/Item_Helper_Test.php +++ b/modules/gallery/tests/Item_Helper_Test.php @@ -20,9 +20,8 @@ class Item_Helper_Test extends Unit_Test_Case { public function viewable_test() { - $root = ORM::factory("item", 1); - $album = album::create($root, rand(), rand(), rand()); - $item = self::_create_random_item($album); + $album = test::random_album(); + $item = test::random_photo($album); identity::set_active_user(identity::guest()); // We can see the item when permissions are granted @@ -38,33 +37,8 @@ class Item_Helper_Test extends Unit_Test_Case { ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all()); } - public function validate_url_safe_test() { - $input = new MockInput(); - $input->value = "Ab_cd-ef-d9"; - item::validate_url_safe($input); - $this->assert_true(!isset($input->not_url_safe)); - - $input->value = "ab&cd"; - item::validate_url_safe($input); - $this->assert_equal(1, $input->not_url_safe); - } - public function convert_filename_to_slug_test() { $this->assert_equal("foo", item::convert_filename_to_slug("{[foo]}")); $this->assert_equal("foo-bar", item::convert_filename_to_slug("{[foo!@#!$@#^$@($!(@bar]}")); } - - private static function _create_random_item($album) { - // Set all required fields (values are irrelevant) - $item = ORM::factory("item"); - $item->name = rand(); - $item->type = "photo"; - return $item->add_to_parent($album); - } } - -class MockInput { - function add_error($error, $value) { - $this->$error = $value; - } -}
\ No newline at end of file |