X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fnobindvars.t;h=b2297563847659e6c95400840ecaf6d6c808da84;hb=65ea9cada6f22fa3159cdf3516bc9bcd5ba7e1a5;hp=d2dd8401f6277f7e21f96b33de74646ba57ed368;hpb=6e6ad6c3e8cb6da6b28c75005753b092b486de20;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/storage/nobindvars.t b/t/storage/nobindvars.t index d2dd840..b229756 100644 --- a/t/storage/nobindvars.t +++ b/t/storage/nobindvars.t @@ -4,17 +4,14 @@ use warnings; use Test::More; use lib qw(t/lib); use DBICTest; -use DBIC::DebugObj; -use DBIC::SqlMakerTest; -use DBI::Const::GetInfoType; { # Fake storage driver for SQLite + no bind variables package DBICTest::SQLite::NoBindVars; - use Class::C3; - use base qw/ - DBIx::Class::Storage::DBI::NoBindVars - DBIx::Class::Storage::DBI::SQLite - /; + use base qw( + DBIx::Class::Storage::DBI::NoBindVars + DBIx::Class::Storage::DBI::SQLite + ); + use mro 'c3'; } my $schema = DBICTest->init_schema (storage_type => 'DBICTest::SQLite::NoBindVars', no_populate => 1); @@ -35,26 +32,13 @@ my $it = $schema->resultset('Artist')->search( {}, is( $it->count, 3, "LIMIT count ok" ); # ask for 3 rows out of 7 artists -my ($sql, @bind); -my $orig_debugobj = $schema->storage->debugobj; -my $orig_debug = $schema->storage->debug; -$schema->storage->debugobj (DBIC::DebugObj->new (\$sql, \@bind) ); -$schema->storage->debug (1); - -is( $it->next->name, "Artist 2", "iterator->next ok" ); -$it->next; -$it->next; -is( $it->next, undef, "next past end of resultset ok" ); - -$schema->storage->debugobj ($orig_debugobj); -$schema->storage->debug ($orig_debug); - -is_same_sql_bind ( - $sql, - \@bind, - 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me ORDER BY artistid LIMIT 3 OFFSET 2', - [], - 'Correctly interpolated SQL' -); +$schema->is_executed_sql_bind( sub { + is( $it->next->name, "Artist 2", "iterator->next ok" ); + $it->next; + $it->next; + is( $it->next, undef, "next past end of resultset ok" ); +}, [ + [ 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me ORDER BY artistid LIMIT 3 OFFSET 2' ], +], 'Correctly interpolated SQL' ); done_testing;