From 8d1790a0b465566439911c05806afea742148773 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 5 Dec 2008 04:56:33 +0000 Subject: * Add a moveTo unit test * Pass the module::event(..., $data) by reference to the handlers --- core/tests/ORM_MPTT_Test.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/tests/ORM_MPTT_Test.php') diff --git a/core/tests/ORM_MPTT_Test.php b/core/tests/ORM_MPTT_Test.php index 733b30ea..cd6b38eb 100644 --- a/core/tests/ORM_MPTT_Test.php +++ b/core/tests/ORM_MPTT_Test.php @@ -55,6 +55,25 @@ class ORM_MPTT_Test extends Unit_Test_Case { $this->assert_equal(3, $album1->right - $album1->left); } + public function move_to_test() { + $album1 = album::create(1, "move_to_test_1", "move_to_test_1"); + $album1_1 = album::create($album1->id, "move_to_test_1_1", "move_to_test_1_1"); + $album1_2 = album::create($album1->id, "move_to_test_1_2", "move_to_test_1_2"); + $album1_1_1 = album::create($album1_1->id, "move_to_test_1_1_1", "move_to_test_1_1_1"); + $album1_1_2 = album::create($album1_1->id, "move_to_test_1_1_2", "move_to_test_1_1_2"); + + $album1_2->reload(); + $album1_1_1->reload(); + + $album1_1_1->moveTo($album1_2); + + $album1_1->reload(); + $album1_2->reload(); + + $this->assert_equal(3, $album1_1->right - $album1_1->left); + $this->assert_equal(3, $album1_2->right - $album1_2 ->left); + } + public function parent_test() { $album = ORM::factory("item")->add_to_parent(1); -- cgit v1.2.3