[Bast-commits] r3334 - branches/DBIx-Class/bulk_create/t

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Sat May 19 16:33:49 GMT 2007


Author: castaway
Date: 2007-05-19 16:33:46 +0100 (Sat, 19 May 2007)
New Revision: 3334

Modified:
   branches/DBIx-Class/bulk_create/t/101populate_rs.t
Log:
Test populate_rs with belongs_to rels


Modified: branches/DBIx-Class/bulk_create/t/101populate_rs.t
===================================================================
--- branches/DBIx-Class/bulk_create/t/101populate_rs.t	2007-05-19 15:06:36 UTC (rev 3333)
+++ branches/DBIx-Class/bulk_create/t/101populate_rs.t	2007-05-19 15:33:46 UTC (rev 3334)
@@ -5,7 +5,7 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 40;
+plan tests => 43;
 
 my $schema = DBICTest->init_schema();
 my $rs = $schema->resultset('Artist');
@@ -148,3 +148,15 @@
 	ok( $girl->cds->count == 3, "got Expected Number of Cds");
 }
 
+## Test from a belongs_to perspective, should create artist first, then CD with artistid in:
+my $cd_rs = $schema->resultset('CD');
+$cd_rs->populate([ 
+                   { title => 'Some CD',
+                     year => 1997,
+                     artist => { name => 'Fred Bloggs'},
+                 }] );
+my $cd = $schema->resultset('CD')->find({title => 'Some CD'});
+
+isa_ok($cd, 'DBICTest::CD', 'Created CD');
+isa_ok($cd->artist, 'DBICTest::Artist', 'Set Artist');
+is($cd->artist->name, 'Fred Bloggs', 'Set Artist to Fred');




More information about the Bast-commits mailing list