summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-18 21:14:43 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-18 21:14:43 -0800
commitb4e6834a28e557c3143f5f3cc91144d1565c18f0 (patch)
tree8f1dade4f524682776fd050e2efd3974796abe4d
parent677fb080026612725d9ed317b5ff6732e00f6514 (diff)
Added move_album_fails_wrong_target_type_test()
-rw-r--r--modules/gallery/tests/Item_Model_Test.php20
1 files changed, 18 insertions, 2 deletions
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);