1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 my $schema = DBICTest->init_schema();
12 my $storage = $schema->storage;
14 $storage = $storage->master
15 if $ENV{DBICTEST_VIA_REPLICATED};
19 for my $disconnect (0, 1) {
20 $schema->storage->_dbh->disconnect if $disconnect;
22 $schema->storage->dbh_do(sub { $_[1]->selectall_arrayref('SELECT 1') }),
24 'dbh_do on fresh handle worked',
29 my $test_func = sub { @args = @_ };
31 $storage->dbh_do($test_func, "foo", "bar");
34 [ $storage, $storage->dbh, "foo", "bar" ],
38 my $storage_class = ref $storage;
41 local *{$storage_class .'::__test_method'} = $test_func;
42 $storage->dbh_do("__test_method", "baz", "buz");
47 [ $storage, $storage->dbh, "baz", "buz" ],
50 # test nested aliasing
52 $schema->storage->dbh_do (sub {
53 shift->dbh_do(sub { $_[3] = 'changed' }, @_)
56 is ($res, 'changed', "Arguments properly aliased for dbh_do");