Get rid of urls_are_rawurlencoded_test -- it's no longer necessary

since we can't have unsafe slugs.

Add basic_validation_test.
This commit is contained in:
Bharat Mediratta
2010-01-17 23:45:18 -08:00
parent 06541f0e2a
commit 31ecb009ba

View File

@@ -163,16 +163,6 @@ class Item_Model_Test extends Unit_Test_Case {
$this->assert_same("NEW_VALUE", $item->title);
}
public function urls_are_rawurlencoded_test() {
$item = test::random_photo_unsaved();
$item->slug = "foo bar";
$item->name = "foo bar.jpg";
$item->save();
$this->assert_equal("foo%20bar", $item->relative_url());
$this->assert_equal("foo%20bar.jpg", $item->relative_path());
}
public function move_album_test() {
$album2 = test::random_album();
$album = test::random_album($album2);
@@ -255,4 +245,34 @@ class Item_Model_Test extends Unit_Test_Case {
return;
}
}
public function basic_validation_test() {
$item = ORM::factory("item");
$item->album_cover_item_id = rand(); // invalid
$item->description = str_repeat("x", 70000); // invalid
$item->name = null;
$item->parent_id = rand();
$item->slug = null;
$item->sort_column = "bogus";
$item->sort_order = "bogus";
$item->title = null;
$item->type = "bogus";
try {
$item->save();
} catch (ORM_Validation_Exception $e) {
$this->assert_same(array("description" => "length",
"name" => "required",
"slug" => "required",
"title" => "required",
"album_cover_item_id" => "invalid_item",
"parent_id" => "invalid",
"sort_column" => "invalid",
"sort_order" => "invalid",
"type" => "invalid"),
$e->validation->errors());
return;
}
$this->assert_false(true, "Shouldn't get here");
}
}