[Bast-commits] r5140 - DBIx-Class/0.08/trunk/t

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Sat Nov 15 21:08:30 GMT 2008


Author: castaway
Date: 2008-11-15 21:08:30 +0000 (Sat, 15 Nov 2008)
New Revision: 5140

Modified:
   DBIx-Class/0.08/trunk/t/96multi_create.t
Log:
Added failing create-multi test


Modified: DBIx-Class/0.08/trunk/t/96multi_create.t
===================================================================
--- DBIx-Class/0.08/trunk/t/96multi_create.t	2008-11-15 19:18:24 UTC (rev 5139)
+++ DBIx-Class/0.08/trunk/t/96multi_create.t	2008-11-15 21:08:30 UTC (rev 5140)
@@ -5,7 +5,7 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 58;
+plan tests => 62;
 
 my $schema = DBICTest->init_schema();
 
@@ -510,3 +510,44 @@
   );
 };
 diag $@ if $@;
+
+## test might_have/has_many interactions
+my $ff = $schema->resultset('ForceForeign');
+
+my $thing = $ff->create(
+    {
+        artist_1 => 
+        { 
+            name => 'Crazy Frog',
+            cds => 
+                [
+                 {
+                     title => 'CD1',
+                     year => 2007,
+                     artist => {
+                         name => 'Artist 1',
+                     }
+                 },
+                 {
+                     title => 'CD2',
+                     year => 2007,
+                     artist => {
+                         name => 'Artist 2',
+                     }
+                 },
+                ],
+        },
+        cd_1 => {
+            title => 'CD3',
+            year => 2008,
+            artist => {
+                name => 'Artist 3',
+            }
+        }
+    }
+    );
+
+isa_ok($thing->artist_1, 'DBICTest::Schema::Artist', 'created might_have artist');
+is($thing->artist_1->name, 'Crazy Frog');
+isa_ok($thing->artist_1->cds, 'DBIx::Class::ResultSet', 'created artists cds');
+is($thing->artist_1->cds->count, 2, 'created two cds for artist');




More information about the Bast-commits mailing list