[Bast-commits] r6936 - DBIx-Class/0.08/trunk/t/prefetch

ijw at dev.catalyst.perl.org ijw at dev.catalyst.perl.org
Thu Jul 2 10:43:48 GMT 2009


Author: ijw
Date: 2009-07-02 10:43:47 +0000 (Thu, 02 Jul 2009)
New Revision: 6936

Modified:
   DBIx-Class/0.08/trunk/t/prefetch/count.t
Log:
Confirm prefetch doesn't affect main row fetch, and main row fetch works with and without counting

Modified: DBIx-Class/0.08/trunk/t/prefetch/count.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/count.t	2009-07-02 10:41:01 UTC (rev 6935)
+++ DBIx-Class/0.08/trunk/t/prefetch/count.t	2009-07-02 10:43:47 UTC (rev 6936)
@@ -5,7 +5,7 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 7;
+plan tests => 9;
 
 my $schema = DBICTest->init_schema();
 
@@ -25,7 +25,8 @@
 
 my $artist=$schema->resultset('Artist')->create({name => 'xxx'});
 my $artist_rs = $schema->resultset('Artist')->search({artistid => $artist->id}, {prefetch=>'cds'});
-is($artist_rs->related_resultset('cds')->count, 0, "No CDs on a brand new artist");
-is($artist_rs->count, 1,
-   "No CDs prefetched but the artist is still returned");
+is($artist_rs->count, 1, "New artist found with prefetch turned on");
+is(scalar($artist_rs->all), 1, "New artist fetched with prefetch turned on");
+is($artist_rs->related_resultset('cds')->count, 0, "No CDs counted on a brand new artist");
+is(scalar($artist_rs->related_resultset('cds')->all), 0, "No CDs fetched on a brand new artist (count == fetch)");
 




More information about the Bast-commits mailing list