[Bast-commits] r6927 - DBIx-Class/0.08/trunk/t/prefetch
ijw at dev.catalyst.perl.org
ijw at dev.catalyst.perl.org
Wed Jul 1 18:04:16 GMT 2009
Author: ijw
Date: 2009-07-01 18:04:16 +0000 (Wed, 01 Jul 2009)
New Revision: 6927
Modified:
DBIx-Class/0.08/trunk/t/prefetch/count.t
Log:
Additional tests on prefetch - illustrates the bug with left-join has_many (NULL row returned) and the one that results from the trivial fix (prefetch gives no artist)
Modified: DBIx-Class/0.08/trunk/t/prefetch/count.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/count.t 2009-07-01 18:01:04 UTC (rev 6926)
+++ DBIx-Class/0.08/trunk/t/prefetch/count.t 2009-07-01 18:04:16 UTC (rev 6927)
@@ -5,7 +5,7 @@
use lib qw(t/lib);
use DBICTest;
-plan tests => 5;
+plan tests => 7;
my $schema = DBICTest->init_schema();
@@ -22,3 +22,10 @@
is($cd_rs->search_related('tracks')->count, 15, 'Tracks associated with CDs count (after SELECT()ing)');
is($cd_rs->search_related ('tracks')->all, 15, 'Track objects associated with CDs (after SELECT()ing)');
+
+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");
+
More information about the Bast-commits
mailing list