From: Justin Hunter Date: Sat, 2 May 2009 01:20:04 +0000 (+0000) Subject: more fixes to tests X-Git-Tag: v0.08103~101^2~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=11d68671189252ea241d119283f75d074cd4457c;p=dbsrgits%2FDBIx-Class.git more fixes to tests --- diff --git a/t/60core.t b/t/60core.t index dd41f38..de290de 100644 --- a/t/60core.t +++ b/t/60core.t @@ -8,7 +8,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 95; +plan tests => 96; eval { require DateTime::Format::MySQL }; my $NO_DTFM = $@ ? 1 : 0; @@ -247,18 +247,28 @@ SKIP: { my $tcount = $schema->resultset('Track')->search( {}, { - select => [ qw/position title/ ] + select => [ qw/position title/ ], + distinct => 1, } ); is($tcount->count, 13, 'multiple column COUNT DISTINCT ok'); - $tcount = $schema->resultset('Track')->search( - {}, - { - group_by => [ qw/position title/ ] - } - ); - is($tcount->count, 13, 'multiple column COUNT DISTINCT using column syntax ok'); + $tcount = $schema->resultset('Track')->search( + {}, + { + columns => [ qw/position title/ ], + distinct => 1, + } + ); + is($tcount->count, 13, 'multiple column COUNT DISTINCT ok'); + + $tcount = $schema->resultset('Track')->search( + {}, + { + group_by => [ qw/position title/ ] + } + ); + is($tcount->count, 13, 'multiple column COUNT DISTINCT using column syntax ok'); } my $tag_rs = $schema->resultset('Tag')->search( diff --git a/t/73oracle.t b/t/73oracle.t index 51cc932..6220ec9 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -106,15 +106,32 @@ is($tjoin->next->title, 'Track1', "ambiguous column ok"); # check count distinct with multiple columns my $other_track = $schema->resultset('Track')->create({ trackid => 2, cd => 1, position => 1, title => 'Track2' }); + my $tcount = $schema->resultset('Track')->search( - {}, - { - select => [{count => {distinct => ['position', 'title']}}], - as => ['count'] - } - ); + {}, + { + select => [ qw/position title/ ], + distinct => 1, + } +); +is($tcount->count, 13, 'multiple column COUNT DISTINCT ok'); + +$tcount = $schema->resultset('Track')->search( + {}, + { + columns => [ qw/position title/ ], + distinct => 1, + } +); +is($tcount->count, 13, 'multiple column COUNT DISTINCT ok'); -is($tcount->next->get_column('count'), 2, "multiple column select distinct ok"); +$tcount = $schema->resultset('Track')->search( + {}, + { + group_by => [ qw/position title/ ] + } +); +is($tcount->count, 13, 'multiple column COUNT DISTINCT using column syntax ok'); # test LIMIT support for (1..6) {