diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-07 06:46:38 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-07 06:46:38 +0000 |
commit | 936decb437cbb19799dcae255af1d4425a850ae3 (patch) | |
tree | 6edc9bd258d255f89b0d98d389feae449fcc147e /core/tests/ORM_MPTT_Test.php | |
parent | 6a1ef44c8842d007dd59574cc76ba767519d124f (diff) |
Add children_count() to ORM_MPTT
Diffstat (limited to 'core/tests/ORM_MPTT_Test.php')
-rw-r--r-- | core/tests/ORM_MPTT_Test.php | 25 |
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()); + } } |