X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finflate%2Fhri.t;h=2bbaae88793945df82b61a5155b0f9bec6bfc0f4;hb=0f2aa8f272df7753ada0601e0d4b00a712d86a2a;hp=35329000de87029d853e684dc5d7940fcc2ff1d9;hpb=c6e0ee83e0c8e607d62871633570fe1e94079e63;p=dbsrgits%2FDBIx-Class.git diff --git a/t/inflate/hri.t b/t/inflate/hri.t index 3532900..2bbaae8 100644 --- a/t/inflate/hri.t +++ b/t/inflate/hri.t @@ -6,7 +6,6 @@ use lib qw(t/lib); 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 = $schema->resultset ('Artist')->search ({ 'me.artistid' => 1}, { }); $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';