X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fresultset%2Finflate_result_api.t;h=e6bedc2b148b136e0d1c20458a4967b7bb3acb75;hb=30681c23187d5f13d57eda0c97dda1be5fb291d1;hp=1fa917a330ffdff1f38d608cd5954f13f8357e78;hpb=6aa939284368cb14aff81ab3c5e3945527f949b0;p=dbsrgits%2FDBIx-Class.git diff --git a/t/resultset/inflate_result_api.t b/t/resultset/inflate_result_api.t index 1fa917a..e6bedc2 100644 --- a/t/resultset/inflate_result_api.t +++ b/t/resultset/inflate_result_api.t @@ -502,4 +502,31 @@ sub cmp_structures { cmp_deeply($left, $right, $msg||()) or next INFTYPE; } +{ + package DBICTest::_DoubleResult; + + sub inflate_result { + my $class = shift; + return map { DBIx::Class::ResultClass::HashRefInflator->inflate_result(@_) } (1,2); + } +} + +my $oxygene_rs = $schema->resultset('CD')->search({ 'me.title' => 'Oxygene' }); + +is_deeply( + [ $oxygene_rs->search({}, { result_class => 'DBICTest::_DoubleResult' })->all ], + [ ({ $oxygene_rs->single->get_columns }) x 2 ], +); + +is_deeply( + [ $oxygene_rs->search({}, { + result_class => 'DBICTest::_DoubleResult', prefetch => [qw(artist tracks)], + order_by => [qw(me.cdid tracks.title)], + })->all ], + [ (@{$oxygene_rs->search({}, { + prefetch=> [qw(artist tracks)], + order_by => [qw(me.cdid tracks.title)], + })->all_hri}) x 2 ], +); + done_testing;