From b4e6834a28e557c3143f5f3cc91144d1565c18f0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 18 Jan 2010 21:14:43 -0800 Subject: Added move_album_fails_wrong_target_type_test() --- modules/gallery/tests/Item_Model_Test.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'modules/gallery') diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index b2193e90..abe872d2 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -217,7 +217,7 @@ class Item_Model_Test extends Unit_Test_Case { $this->assert_equal("file", file_get_contents($photo->file_path())); } - public function move_album_fails_invalid_target_test() { + public function move_album_fails_conflicting_target_test() { $album = test::random_album(); $source = test::random_album_unsaved($album); $source->name = $album->name; @@ -236,7 +236,23 @@ class Item_Model_Test extends Unit_Test_Case { } } - public function move_photo_fails_invalid_target_test() { + public function move_album_fails_wrong_target_type_test() { + $album = test::random_album(); + $photo = test::random_photo(); + + // $source and $album have the same name, so if we move $source into the root they should + // conflict. + + try { + $album->parent_id = $photo->id; + $album->save(); + $this->assert_true(false, "Shouldn't get here"); + } catch (ORM_Validation_Exception $e) { + $this->assert_equal(array("parent_id" => "invalid"), $e->validation->errors()); + } + } + + public function move_photo_fails_conflicting_target_test() { $photo1 = test::random_photo(); $album = test::random_album(); $photo2 = test::random_photo_unsaved($album); -- cgit v1.2.3