X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F80unique.t;h=726a2b22cbd39668d24df24149cf48c709166164;hb=c40b5744f85a8ffc2da494464655936387c04251;hp=7f78ef524c410a17247e35988fdab7ba07ccdea3;hpb=e29e2b27d08d645f8a50d7ffafef28c67688207e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/80unique.t b/t/80unique.t index 7f78ef5..726a2b2 100644 --- a/t/80unique.t +++ b/t/80unique.t @@ -1,13 +1,13 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Test::Exception; use Test::Warn; -use lib qw(t/lib); + use DBICTest; -use DBIC::SqlMakerTest; -use DBIC::DebugObj; my $schema = DBICTest->init_schema(); @@ -226,25 +226,14 @@ is($row->baz, 3, 'baz is correct'); # make sure the ident condition is assembled sanely { - my $artist = $schema->resultset('Artist')->next; - - my ($sql, @bind); - my $old_debugobj = $schema->storage->debugobj; - my $old_debug = $schema->storage->debug; - $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)), - $schema->storage->debug(1); - - $artist->discard_changes; - - is_same_sql_bind ( - $sql, - \@bind, - 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE me.artistid = ?', - [qw/'1'/], - ); - - $schema->storage->debug($old_debug); - $schema->storage->debugobj($old_debugobj); + my $artist = $schema->resultset('Artist')->find(1); + + $schema->is_executed_sql_bind( sub { $artist->discard_changes }, [ + [ + 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE me.artistid = ?', + [ { dbic_colname => "me.artistid", sqlt_datatype => "integer" } => 1 ], + ] + ], 'Expected query on discard_changes'); } {