Commit | Line | Data |
5e120ab6 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | use DBIC::SqlMakerTest; |
8 | |
9 | my $schema = DBICTest->init_schema(); |
10 | |
11 | my $rs = $schema->resultset('CD')->search({}, { |
12 | 'join' => 'tracks', |
13 | order_by => { |
14 | -desc => { |
15 | count => 'tracks.track_id', |
16 | }, |
17 | }, |
18 | distinct => 1, |
19 | rows => 2, |
20 | page => 1, |
21 | }); |
22 | my $match = q{ |
23 | SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me |
24 | GROUP BY me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track |
25 | ORDER BY COUNT(tracks.trackid) DESC |
26 | }; |
27 | |
28 | TODO: { |
29 | todo_skip 'order_by using function', 2; |
30 | is_same_sql($rs->as_query, $match, 'order by with func query'); |
31 | |
32 | ok($rs->count == 2, 'amount of rows return in order by func query'); |
33 | } |
34 | |
35 | done_testing; |