From: Peter Rabbitson Date: Tue, 25 Aug 2009 09:33:40 +0000 (+0000) Subject: One more test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7cc643b453ec0373b31624ffd3b09b07b925ac3e;p=dbsrgits%2FDBIx-Class-Historic.git One more test --- diff --git a/t/prefetch/grouped.t b/t/prefetch/grouped.t index 501b250..7f97943 100644 --- a/t/prefetch/grouped.t +++ b/t/prefetch/grouped.t @@ -280,6 +280,25 @@ for ($cd_rs->all) { is($cd_rs->count, 5, 'complex prefetch + non-prefetching has_many join count correct'); is($cd_rs->all, 5, 'complex prefetch + non-prefetching has_many join number of objects correct'); + # make sure join tracks was thrown out + is_same_sql_bind ( + $cd_rs->as_query, + '( + SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, + artist.artistid, artist.name, artist.rank, artist.charfield + FROM ( + SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track + FROM cd me + JOIN artist artist ON artist.artistid = me.artist + GROUP BY me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track + ) me + JOIN artist artist ON artist.artistid = me.artist + )', + [], + ); + + + # try the same as above, but add a condition so the tracks join can not be thrown away my $cd_rs2 = $cd_rs->search ({ 'tracks.title' => { '!=' => 'ugabuganoexist' } }); is($cd_rs2->count, 5, 'complex prefetch + non-prefetching restricted has_many join count correct');