X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fdbh_do.t;h=727c245ef76b92ca4d88a817c72de3c727ad9e7a;hb=8b60b9211a085572446bbfd19e879d00ae03658a;hp=82e33d81920e992b43ffeeaffd9ff6e00b9c79d0;hpb=f54428abf9cc7d7e5604745335694eaf558f6820;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/storage/dbh_do.t b/t/storage/dbh_do.t index 82e33d8..727c245 100644 --- a/t/storage/dbh_do.t +++ b/t/storage/dbh_do.t @@ -9,6 +9,20 @@ use DBICTest; my $schema = DBICTest->init_schema(); my $storage = $schema->storage; +$storage = $storage->master + if $ENV{DBICTEST_VIA_REPLICATED}; + + +# test (re)connection +for my $disconnect (0, 1) { + $schema->storage->_dbh->disconnect if $disconnect; + is_deeply ( + $schema->storage->dbh_do(sub { $_[1]->selectall_arrayref('SELECT 1') }), + [ [ 1 ] ], + 'dbh_do on fresh handle worked', + ); +} + my @args; my $test_func = sub { @args = @_ }; @@ -31,9 +45,11 @@ is_deeply ( [ $storage, $storage->dbh, "baz", "buz" ], ); -# test aliasing +# test nested aliasing my $res = 'original'; -$storage->dbh_do (sub { $_[2] = 'changed' }, $res); +$schema->storage->dbh_do (sub { + shift->dbh_do(sub { $_[3] = 'changed' }, @_) +}, $res); is ($res, 'changed', "Arguments properly aliased for dbh_do");