X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F18insert_default.t;h=17657cc660048c8a57c0e48f92c4bbc75364ba5a;hb=f21ae8f77062762fc2d9aef89242b59f27172b3c;hp=cd49cecb9be31077a619e96a373d072eb9f507c1;hpb=20595c02ab4627497090c5081506c1fbac3dd57d;p=dbsrgits%2FDBIx-Class.git diff --git a/t/18insert_default.t b/t/18insert_default.t index cd49cec..17657cc 100644 --- a/t/18insert_default.t +++ b/t/18insert_default.t @@ -2,11 +2,8 @@ use strict; use warnings; use Test::More; -use Test::Exception; use lib qw(t/lib); use DBICTest; -use DBIC::DebugObj; -use DBIC::SqlMakerTest; my $schema = DBICTest->init_schema(); $schema->storage->sql_maker->quote_char('"'); @@ -15,27 +12,12 @@ my $rs = $schema->resultset ('Artist'); my $last_obj = $rs->search ({}, { order_by => { -desc => 'artistid' }, rows => 1})->single; my $last_id = $last_obj ? $last_obj->artistid : 0; - -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); - my $obj; -lives_ok { $obj = $rs->create ({}) } 'Default insert successful'; - -$schema->storage->debugobj ($orig_debugobj); -$schema->storage->debug ($orig_debug); - -is_same_sql_bind ( - $sql, - \@bind, - 'INSERT INTO "artist" DEFAULT VALUES', - [], - 'Default-value insert correct SQL', -); +$schema->is_executed_sql_bind( sub { + $obj = $rs->create ({}) +}, [[ + 'INSERT INTO "artist" DEFAULT VALUES' +]], 'Default-value insert correct SQL' ); ok ($obj, 'Insert defaults ( $rs->create ({}) )' );