[Bast-commits] r6704 - DBIx-Class/0.08/trunk/t/inflate
abraxxa at dev.catalyst.perl.org
abraxxa at dev.catalyst.perl.org
Thu Jun 18 10:30:01 GMT 2009
Author: abraxxa
Date: 2009-06-18 10:30:01 +0000 (Thu, 18 Jun 2009)
New Revision: 6704
Modified:
DBIx-Class/0.08/trunk/t/inflate/hri.t
Log:
added test for nested has_many prefetch without entries
Modified: DBIx-Class/0.08/trunk/t/inflate/hri.t
===================================================================
--- DBIx-Class/0.08/trunk/t/inflate/hri.t 2009-06-18 06:40:18 UTC (rev 6703)
+++ DBIx-Class/0.08/trunk/t/inflate/hri.t 2009-06-18 10:30:01 UTC (rev 6704)
@@ -6,7 +6,6 @@
use DBICTest;
my $schema = DBICTest->init_schema();
-
# Under some versions of SQLite if the $rs is left hanging around it will lock
# So we create a scope here cos I'm lazy
{
@@ -124,3 +123,16 @@
});
$rs_hashrefinf->result_class('DBIx::Class::ResultClass::HashRefInflator');
is_deeply [$rs_hashrefinf->all], \@hashrefinf, 'Check query using extended columns syntax';
+
+# check nested prefetching of has_many relationships which return nothing
+my $artist = $schema->resultset ('Artist')->create ({ name => 'unsuccessful artist without CDs'});
+my $rs_artists = $schema->resultset ('Artist')->search ({ 'me.artistid' => $artist->id}, {
+ prefetch => { cds => 'tracks' },
+});
+$rs_artists->result_class('DBIx::Class::ResultClass::HashRefInflator');
+my @artists_ok = ({
+ artistid => $artist->id,
+ name => "unsuccessful artist without CDs",
+ cds => [],
+});
+is_deeply [$rs_artists->all], \@artists_ok, 'nested has_many prefetch without entries';
More information about the Bast-commits
mailing list