From: Marcus Ramberg Date: Wed, 22 Feb 2006 14:14:58 +0000 (+0000) Subject: having tests. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6991aba3b8b1b3187ff96a2f10120a895e1e5646;p=dbsrgits%2FDBIx-Class-Historic.git having tests. --- diff --git a/t/run/16joins.tl b/t/run/16joins.tl index 80444e7..5ea8749 100644 --- a/t/run/16joins.tl +++ b/t/run/16joins.tl @@ -253,7 +253,24 @@ SKIP: { cmp_ok( $rs->count, '==', 3, "count() ok after group_by on related column" ); } -cmp_ok( scalar $rs->all, '==', 3, "all() returns same count as count() after group_by on related column" ); +$rs = $schema->resultset("CD")->search( + {}, + { join => [qw/ artist /], group_by => [qw/ artist.name /], having =>{ 'MAX(cd.id)'=>{'<',5 } } } +); + +SKIP: { + skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1 + if $is_broken_sqlite; + cmp_ok( $rs->count, '==', 2, "count() ok after group_by on related column with a having" ); +} + +$rs = $rs->search( {1=>1}, { having =>{ 'count(*)'=>{'>',2 } }}); + +SKIP: { + skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1 + if $is_broken_sqlite; + cmp_ok( $rs->count, '==', 1, "count() ok after group_by on related column with a having" ); +} $rs = $schema->resultset("Artist")->search( { 'cds.title' => 'Spoonful of bees',