From: Wallace Reis Date: Wed, 12 May 2010 01:44:39 +0000 (+0000) Subject: add failing test for order_by using a function X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5e120ab6a144761854254b82527fac3088cc8d71;p=dbsrgits%2FDBIx-Class-Historic.git add failing test for order_by using a function --- diff --git a/t/sqlahacks/order_by_func.t b/t/sqlahacks/order_by_func.t new file mode 100644 index 0000000..51968ed --- /dev/null +++ b/t/sqlahacks/order_by_func.t @@ -0,0 +1,35 @@ +use strict; +use warnings; +use Test::More; + +use lib qw(t/lib); +use DBICTest; +use DBIC::SqlMakerTest; + +my $schema = DBICTest->init_schema(); + +my $rs = $schema->resultset('CD')->search({}, { + 'join' => 'tracks', + order_by => { + -desc => { + count => 'tracks.track_id', + }, + }, + distinct => 1, + rows => 2, + page => 1, +}); +my $match = q{ + SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me + GROUP BY me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track + ORDER BY COUNT(tracks.trackid) DESC +}; + +TODO: { + todo_skip 'order_by using function', 2; + is_same_sql($rs->as_query, $match, 'order by with func query'); + + ok($rs->count == 2, 'amount of rows return in order by func query'); +} + +done_testing;