From 06541f0e2a5cb9ee78b6b1553dd522dcc33a1b3d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 17 Jan 2010 21:49:48 -0800 Subject: Fix item_rename_fails_with_existing_name_test() -- broken because of http://dev.kohanaphp.com/issues/2504 --- modules/gallery/tests/Item_Model_Test.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index a2720f7d..c4e150a6 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -141,17 +141,16 @@ class Item_Model_Test extends Unit_Test_Case { $item = test::random_photo(); $item2 = test::random_photo(); - $new_name = $item2->name; - try { - $item->rename($new_name)->save(); - } catch (Exception $e) { - // pass - $this->assert_true(strpos($e->getMessage(), "INVALID_RENAME_FILE_EXISTS") !== false, - "incorrect exception."); + $item->name = $item2->name; + $item->validate(); // @todo: switch this to save() once + // http://dev.kohanaphp.com/issues/2504 is fixed. + } catch (ORM_Validation_Exception $e) { + $this->assert_true(in_array("conflict", $e->validation->errors())); return; } - $this->assert_false(true, "Item_Model::rename should fail."); + + $this->assert_false(true, "rename should conflict"); } public function save_original_values_test() { -- cgit v1.2.3