From ee2407cde2b45aa667d30ca24f483c729340f462 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 11 Mar 2009 00:41:51 +0000 Subject: Fix the test failures. If albums are created manually instead of calling album::create, then the default sourt column needs to be set to id. --- core/tests/Access_Helper_Test.php | 4 ++++ core/tests/ORM_MPTT_Test.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'core/tests') diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php index 0c39f841..4b53c0ce 100644 --- a/core/tests/Access_Helper_Test.php +++ b/core/tests/Access_Helper_Test.php @@ -64,6 +64,10 @@ class Access_Helper_Test extends Unit_Test_Case { $root = ORM::factory("item", 1); $item = ORM::factory("item"); $item->type = "album"; + $item->rand_key = ((float)mt_rand()) / (float)mt_getrandmax(); + $item->sort_column = "id"; + $item->sort_order = "ASC"; + $item->add_to_parent($root); // Simulate an event diff --git a/core/tests/ORM_MPTT_Test.php b/core/tests/ORM_MPTT_Test.php index f16d7e59..7109d43b 100644 --- a/core/tests/ORM_MPTT_Test.php +++ b/core/tests/ORM_MPTT_Test.php @@ -22,6 +22,9 @@ class ORM_MPTT_Test extends Unit_Test_Case { private function create_item_and_add_to_parent($parent) { $album = ORM::factory("item"); $album->type = "album"; + $album->rand_key = ((float)mt_rand()) / (float)mt_getrandmax(); + $album->sort_column = "id"; + $album->sort_order = "ASC"; $album->add_to_parent($parent); return $album; } @@ -30,6 +33,9 @@ class ORM_MPTT_Test extends Unit_Test_Case { $root = ORM::factory("item", 1); $album = ORM::factory("item"); $album->type = "album"; + $album->rand_key = ((float)mt_rand()) / (float)mt_getrandmax(); + $album->sort_column = "id"; + $album->sort_order = "ASC"; $album->add_to_parent($root); $this->assert_equal($album->parent()->right - 2, $album->left); @@ -152,6 +158,9 @@ class ORM_MPTT_Test extends Unit_Test_Case { $parent = ORM::factory("item"); $parent->type = "album"; + $parent->rand_key = ((float)mt_rand()) / (float)mt_getrandmax(); + $parent->sort_column = "id"; + $parent->sort_order = "ASC"; $parent->add_to_parent($root); $photo = ORM::factory("item"); @@ -160,6 +169,9 @@ class ORM_MPTT_Test extends Unit_Test_Case { $album1 = ORM::factory("item"); $album1->type = "album"; + $album1->rand_key = ((float)mt_rand()) / (float)mt_getrandmax(); + $album1->sort_column = "id"; + $album1->sort_order = "ASC"; $album1->add_to_parent($parent); $photo1 = ORM::factory("item"); -- cgit v1.2.3