[Bast-commits] r4629 - DBIx-Class-Tree-NestedSet/t
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Fri Jul 25 01:43:45 BST 2008
Author: rafl
Date: 2008-07-25 01:43:45 +0100 (Fri, 25 Jul 2008)
New Revision: 4629
Modified:
DBIx-Class-Tree-NestedSet/t/basic.t
Log:
More tests.
Modified: DBIx-Class-Tree-NestedSet/t/basic.t
===================================================================
--- DBIx-Class-Tree-NestedSet/t/basic.t 2008-07-25 00:43:40 UTC (rev 4628)
+++ DBIx-Class-Tree-NestedSet/t/basic.t 2008-07-25 00:43:45 UTC (rev 4629)
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 13;
use DBICx::TestDatabase;
use FindBin;
@@ -17,7 +17,16 @@
my $root_node = $trees->create({ content => 'foo' });
isa_ok($root_node, 'DBIx::Class::Row');
-is($root_node->children->count, 0);
+is($root_node->root->id, $root_node->id, 'root field gets set automatically');
+is($root_node->children->count, 0, 'no children, initially');
+is($root_node->nodes->count, 1, 'nodes include self');
my $child_node = $root_node->add_to_children({ content => 'bar' });
-is($root_node->children->count, 1);
+is($root_node->children->count, 1, 'now one child');
+is($root_node->nodes->count, 2, '... and two related nodes');
+
+my $subchild = $child_node->add_to_children({ content => 'moo' });
+is($root_node->children->count, 2, 'root now two childs');
+is($root_node->nodes->count, 3, '... and three related nodes');
+is($child_node->children->count, 1, 'subnode has one children');
+is($child_node->nodes->count, 3, '... and three related nodes as well');
More information about the Bast-commits
mailing list