X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsqlmaker%2Forder_by_bindtransport.t;h=f99a19182e6bdd7bdc5fd900eab4aa0290eb60c0;hb=c0329273268971824784f239f32c7246e68da9c5;hp=f88473969599710404acbfbb6a3c877605252be6;hpb=ba35721ab163a551f351de4dfb4043a4a8217649;p=dbsrgits%2FDBIx-Class.git diff --git a/t/sqlmaker/order_by_bindtransport.t b/t/sqlmaker/order_by_bindtransport.t index f884739..f99a191 100644 --- a/t/sqlmaker/order_by_bindtransport.t +++ b/t/sqlmaker/order_by_bindtransport.t @@ -1,20 +1,16 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Test::Exception; use Data::Dumper::Concise; -use lib qw(t/lib); -use DBICTest; -use DBIC::SqlMakerTest; - -my $schema = DBICTest->init_schema; -my $rs = $schema->resultset('FourKeys'); +use DBICTest ':DiffSQL'; sub test_order { - - TODO: { + my $rs = shift; my $args = shift; local $TODO = "Not implemented" if $args->{todo}; @@ -30,23 +26,25 @@ sub test_order { } )->as_query, "( - SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count - FROM fourkeys me - WHERE ( foo = ? ) + SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count + FROM fourkeys me + WHERE ( foo = ? ) HAVING read_count > ? OR read_count < ? ORDER BY $args->{order_req} )", [ - [qw(foo bar)], - [qw(read_count 5)], - [qw(read_count 8)], + [ { sqlt_datatype => 'integer', dbic_colname => 'foo' } + => 'bar' ], + [ { sqlt_datatype => 'int', dbic_colname => 'read_count' } + => 5 ], + [ { sqlt_datatype => 'int', dbic_colname => 'read_count' } + => 8 ], $args->{bind} - ? @{ $args->{bind} } + ? map { [ { dbic_colname => $_->[0] } => $_->[1] ] } @{ $args->{bind} } : () ], ) || diag Dumper $args->{order_by}; }; - } } my @tests = ( @@ -97,6 +95,7 @@ my @tests = ( }, ); -test_order($_) for @tests; +my $rs = DBICTest->init_schema->resultset('FourKeys'); +test_order($rs, $_) for @tests; done_testing;