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

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Feb 26 23:28:29 GMT 2009


Author: ribasushi
Date: 2009-02-26 23:28:29 +0000 (Thu, 26 Feb 2009)
New Revision: 5648

Modified:
   DBIx-Class/0.08/trunk/t/77prefetch.t
Log:
Small test enhancement

Modified: DBIx-Class/0.08/trunk/t/77prefetch.t
===================================================================
--- DBIx-Class/0.08/trunk/t/77prefetch.t	2009-02-25 14:14:38 UTC (rev 5647)
+++ DBIx-Class/0.08/trunk/t/77prefetch.t	2009-02-26 23:28:29 UTC (rev 5648)
@@ -17,7 +17,7 @@
     eval "use DBD::SQLite";
     plan $@
         ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 68 );
+        : ( tests => 74 );
 }
 
 # figure out if we've got a version of sqlite that is older than 3.2.6, in
@@ -468,10 +468,18 @@
 {
     local $SIG{__WARN__} = sub { $w = shift };
 
-    my $track = $schema->resultset('CD')->search ({ 'me.title' => 'Forkful of bees' }, { prefetch => [qw/tracks tags/] })->first->tracks->first;
-    like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
-        'warning on attempt to prefetch several same level has_many\'s (1 -> M + M)');
-    my $tag = $schema->resultset('LinerNotes')->search ({ notes => 'Buy Whiskey!' }, { prefetch => { cd => [qw/tags tracks/] } })->first->cd->tags->first;
-    like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
-        'warning on attempt to prefetch several same level has_many\'s (M -> 1 -> M + M)');
+    my $rs = $schema->resultset('CD')->search ({ 'me.title' => 'Forkful of bees' }, { prefetch => [qw/tracks tags/] });
+    for (qw/all count next first/) {
+        undef $w;
+        my @stuff = $rs->search()->$_;
+        like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
+            "warning on ->$_ attempt prefetching several same level has_manys (1 -> M + M)");
+    }
+    my $rs2 = $schema->resultset('LinerNotes')->search ({ notes => 'Buy Whiskey!' }, { prefetch => { cd => [qw/tags tracks/] } });
+    for (qw/all count next first/) {
+        undef $w;
+        my @stuff = $rs2->search()->$_;
+        like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
+            "warning on ->$_ attempt prefetching several same level has_manys (M -> 1 -> M + M)");
+    }
 }




More information about the Bast-commits mailing list