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.
This commit is contained in:
Tim Almdal
2009-03-11 00:41:51 +00:00
parent 2ce44b6b08
commit ee2407cde2
2 changed files with 16 additions and 0 deletions

View File

@@ -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

View File

@@ -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");