From: Peter Rabbitson Date: Thu, 14 May 2009 11:19:35 +0000 (+0000) Subject: Straightforward test changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d07ee31ae6149b214e70a33888d0c3e771de2009;p=dbsrgits%2FDBIx-Class-Historic.git Straightforward test changes --- diff --git a/t/19quotes.t b/t/19quotes.t index 622eefb..75b4668 100644 --- a/t/19quotes.t +++ b/t/19quotes.t @@ -35,9 +35,12 @@ $rs = $schema->resultset('CD')->search( { join => 'artist' }); eval { $rs->count }; is_same_sql_bind( - $sql, \@bind, - "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"], - 'got correct SQL for count query with quoting' + $sql, + \@bind, + "SELECT COUNT( * ) FROM (SELECT `me`.`cdid` FROM `cd` `me` JOIN `artist` `artist` ON `artist`.`artistid` = `me`.`artist` WHERE ( ( `artist`.`name` = ? AND `me`.`year` = ? ) ) GROUP BY `me`.`cdid`) `count_subq`", + ["'Caterwauler McCrae'", "'2001'"], + + 'got correct SQL for joined count query with quoting' ); my $order = 'year DESC'; @@ -59,8 +62,10 @@ $rs = $schema->resultset('CD')->search( { join => 'artist' }); eval { $rs->count }; is_same_sql_bind( - $sql, \@bind, - "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"], + $sql, + \@bind, + "SELECT COUNT( * ) FROM (SELECT [me].[cdid] FROM [cd] [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( ( [artist].[name] = ? AND [me].[year] = ? ) ) GROUP BY [me].[cdid]) [count_subq]", + ["'Caterwauler McCrae'", "'2001'"], 'got correct SQL for count query with bracket quoting' ); diff --git a/t/19quotes_newstyle.t b/t/19quotes_newstyle.t index 80e6d04..4e49117 100644 --- a/t/19quotes_newstyle.t +++ b/t/19quotes_newstyle.t @@ -41,8 +41,10 @@ $rs = $schema->resultset('CD')->search( { join => 'artist' }); eval { $rs->count }; is_same_sql_bind( - $sql, \@bind, - "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"], + $sql, + \@bind, + "SELECT COUNT( * ) FROM (SELECT `me`.`cdid` FROM `cd` `me` JOIN `artist` `artist` ON `artist`.`artistid` = `me`.`artist` WHERE ( ( `artist`.`name` = ? AND `me`.`year` = ? ) ) GROUP BY `me`.`cdid`) `count_subq`", + ["'Caterwauler McCrae'", "'2001'"], 'got correct SQL for count query with quoting' ); @@ -72,8 +74,10 @@ $rs = $schema->resultset('CD')->search( { join => 'artist' }); eval { $rs->count }; is_same_sql_bind( - $sql, \@bind, - "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"], + $sql, + \@bind, + "SELECT COUNT( * ) FROM (SELECT [me].[cdid] FROM [cd] [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( ( [artist].[name] = ? AND [me].[year] = ? ) ) GROUP BY [me].[cdid]) [count_subq]", + ["'Caterwauler McCrae'", "'2001'"], 'got correct SQL for count query with bracket quoting' ); diff --git a/t/count/count_joined.t b/t/count/count_joined.t index 992d23b..139f9cd 100644 --- a/t/count/count_joined.t +++ b/t/count/count_joined.t @@ -11,8 +11,7 @@ plan tests => 1; my $schema = DBICTest->init_schema(); -TODO: { - local $TODO = 'Needs -paren fixes in SQLA before it can work'; +{ my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } }); is($cds->count, 1, "extra joins do not explode single entity count"); }