[Bast-commits] r9212 - in DBIx-Class-Tree/trunk: . t/lib t/lib/TreeTest/Schema

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Apr 25 16:29:07 GMT 2010


Author: ribasushi
Date: 2010-04-25 17:29:07 +0100 (Sun, 25 Apr 2010)
New Revision: 9212

Modified:
   DBIx-Class-Tree/trunk/Makefile.PL
   DBIx-Class-Tree/trunk/t/lib/TreeTest.pm
   DBIx-Class-Tree/trunk/t/lib/TreeTest/Schema/Node.pm
Log:
Test for copy() compatibility

Modified: DBIx-Class-Tree/trunk/Makefile.PL
===================================================================
--- DBIx-Class-Tree/trunk/Makefile.PL	2010-04-25 10:38:17 UTC (rev 9211)
+++ DBIx-Class-Tree/trunk/Makefile.PL	2010-04-25 16:29:07 UTC (rev 9212)
@@ -14,6 +14,7 @@
 resources 'repository'  => 'http://dev.catalyst.perl.org/repos/bast/DBIx-Class-Tree/';
 
 requires        'DBIx::Class' => '0.08100';
+test_requires   'Test::Exception';
 
 WriteAll;
 

Modified: DBIx-Class-Tree/trunk/t/lib/TreeTest/Schema/Node.pm
===================================================================
--- DBIx-Class-Tree/trunk/t/lib/TreeTest/Schema/Node.pm	2010-04-25 10:38:17 UTC (rev 9211)
+++ DBIx-Class-Tree/trunk/t/lib/TreeTest/Schema/Node.pm	2010-04-25 16:29:07 UTC (rev 9212)
@@ -2,8 +2,6 @@
 use strict;
 use warnings;
 
-use Carp qw( croak );
-
 use base qw( DBIx::Class );
 
 __PACKAGE__->load_components(qw(
@@ -13,14 +11,16 @@
 
 __PACKAGE__->table('nodes');
 
-__PACKAGE__->add_columns(qw(
-    node_id
+__PACKAGE__->add_columns(
+    node_id => { is_auto_increment => 1 },
+  qw/
     name
     parent_id
     position
     lft
     rgt
-));
+  /
+);
 
 __PACKAGE__->set_primary_key( 'node_id' );
 

Modified: DBIx-Class-Tree/trunk/t/lib/TreeTest.pm
===================================================================
--- DBIx-Class-Tree/trunk/t/lib/TreeTest.pm	2010-04-25 10:38:17 UTC (rev 9211)
+++ DBIx-Class-Tree/trunk/t/lib/TreeTest.pm	2010-04-25 16:29:07 UTC (rev 9212)
@@ -3,12 +3,13 @@
 use warnings;
 
 use Test::More;
+use Test::Exception;
 use TreeTest::Schema;
 
 our $NODE_COUNT = 80;
 
 sub count_tests {
-    my $count = 13;
+    my $count = 14;
     if( TreeTest::Schema::Node->can('position_column') ){
         $count ++;
     }
@@ -27,6 +28,12 @@
         my $node = $nodes->create({ name=>'child' });
         $node->parent( $parent_id );
     }
+
+    lives_and ( sub {
+      warn "BEGIN!!!!!\n\n";
+      is( $nodes->find(3)->copy({name => 'special'})->name,'special','copy test');
+    }, 'copy does not throw');
+
     ok( ($nodes->count()==81), 'correct number of nodes in random tree' );
     ok( ($nodes->find(3)->children->count()==7), 'node 3 has correct number of children' );
     ok( ($nodes->find(22)->children->count()==3), 'node 22 has correct number of children' );




More information about the Bast-commits mailing list