summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-01-11 05:19:09 +0000
committerAndy Staudacher <andy.st@gmail.com>2009-01-11 05:19:09 +0000
commit5e0d0f546a6cdfe5828cc8ccdacec6608b7b9ae7 (patch)
tree439f1c81e2b47cc76185d695db159e79fa489e71
parent4757126acc3fe822daed205fe86e76a8c9748b60 (diff)
MySQL strict fix for Item_Model test. Set all fields that have no default value.
-rw-r--r--core/tests/Item_Model_Test.php21
1 files changed, 14 insertions, 7 deletions
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);