X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fdbh_do.t;h=0beb8581ebec45bdcbbe30082ef08b5887db8dd9;hb=85ad63df4eaa9b308b9ca5a3cd1aa20b9f730312;hp=a5a58d6200aa4d518455f16a074254f10d24545e;hpb=492bb85a977b5b708fd87af25ebd41a459a9087b;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/dbh_do.t b/t/storage/dbh_do.t index a5a58d6..0beb858 100644 --- a/t/storage/dbh_do.t +++ b/t/storage/dbh_do.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; @@ -11,6 +9,16 @@ use DBICTest; my $schema = DBICTest->init_schema(); my $storage = $schema->storage; +# 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 = @_ }; @@ -33,4 +41,12 @@ is_deeply ( [ $storage, $storage->dbh, "baz", "buz" ], ); +# test nested aliasing +my $res = 'original'; +$storage->dbh_do (sub { + shift->dbh_do(sub { $_[3] = 'changed' }, @_) +}, $res); + +is ($res, 'changed', "Arguments properly aliased for dbh_do"); + done_testing;