summaryrefslogtreecommitdiff
path: root/core/tests/ORM_MPTT_Test.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/ORM_MPTT_Test.php')
-rw-r--r--core/tests/ORM_MPTT_Test.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/tests/ORM_MPTT_Test.php b/core/tests/ORM_MPTT_Test.php
index a543c1cd..d66006f5 100644
--- a/core/tests/ORM_MPTT_Test.php
+++ b/core/tests/ORM_MPTT_Test.php
@@ -69,4 +69,29 @@ class ORM_MPTT_Test extends Unit_Test_Case {
}
$this->assert_equal(array($inner1->id, $inner2->id), $child_ids);
}
+
+ public function children_limit_test() {
+ $outer = ORM::factory("item");
+ $outer->add_to_parent(1);
+
+ $inner1 = ORM::factory("item");
+ $inner1->add_to_parent($outer->id);
+
+ $inner2 = ORM::factory("item");
+ $inner2->add_to_parent($outer->id);
+
+ $this->assert_equal(array($inner2->id => null), $outer->children(1, 1)->select_list('id'));
+ }
+
+ public function children_count_test() {
+ $outer = ORM::factory("item");
+ $outer->add_to_parent(1);
+
+ $inner1 = ORM::factory("item");
+ $inner1->add_to_parent($outer->id);
+
+ $inner2 = ORM::factory("item");
+ $inner2->add_to_parent($outer->id);
+ $this->assert_equal(2, $outer->children_count());
+ }
}