From 5e0d0f546a6cdfe5828cc8ccdacec6608b7b9ae7 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sun, 11 Jan 2009 05:19:09 +0000 Subject: MySQL strict fix for Item_Model test. Set all fields that have no default value. --- core/tests/Item_Model_Test.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'core/tests') diff --git a/core/tests/Item_Model_Test.php b/core/tests/Item_Model_Test.php index 6024366b..e7c48917 100644 --- a/core/tests/Item_Model_Test.php +++ b/core/tests/Item_Model_Test.php @@ -19,17 +19,26 @@ */ class Item_Model_Test extends Unit_Test_Case { public function saving_sets_created_and_updated_dates_test() { - $item = ORM::factory("item"); - $item->name = rand(); - $item->save(); + $item = self::create_random_item(); $this->assert_true(!empty($item->created)); $this->assert_true(!empty($item->updated)); } - public function updating_doesnt_change_created_date_test() { + private function create_random_item() { $item = ORM::factory("item"); + /* Set all required fields (values are irrelevant) */ $item->name = rand(); + $item->type = "photo"; + $item->left = 1; + $item->right = 1; + $item->level = 1; + $item->parent_id = 1; $item->save(); + return $item; + } + + public function updating_doesnt_change_created_date_test() { + $item = self::create_random_item(); // Force the creation date to something well known $db = Database::instance(); @@ -44,9 +53,7 @@ class Item_Model_Test extends Unit_Test_Case { } public function updating_view_count_only_doesnt_change_updated_date_test() { - $item = ORM::factory("item"); - $item->name = rand(); - $item->save(); + $item = self::create_random_item(); $item->reload(); $this->assert_same(0, $item->view_count); -- cgit v1.2.3