[Bast-commits] r9350 - DBIx-Class/0.08/trunk/t/sqlahacks
wreis at dev.catalyst.perl.org
wreis at dev.catalyst.perl.org
Wed May 12 01:44:39 GMT 2010
Author: wreis
Date: 2010-05-12 02:44:39 +0100 (Wed, 12 May 2010)
New Revision: 9350
Added:
DBIx-Class/0.08/trunk/t/sqlahacks/order_by_func.t
Log:
add failing test for order_by using a function
Added: DBIx-Class/0.08/trunk/t/sqlahacks/order_by_func.t
===================================================================
--- DBIx-Class/0.08/trunk/t/sqlahacks/order_by_func.t (rev 0)
+++ DBIx-Class/0.08/trunk/t/sqlahacks/order_by_func.t 2010-05-12 01:44:39 UTC (rev 9350)
@@ -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;
More information about the Bast-commits
mailing list