X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fon_connect_call.t;h=bea50850f4345c9c5185d645a86b5073b9006122;hb=a218ef4eb924a4db078cc00a525510a7b955c1eb;hp=880fa3b4acd99399332123b39de87f5b6df071c7;hpb=f602cd7bdcd5c981f738a05ade4790110c79c3d2;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/on_connect_call.t b/t/storage/on_connect_call.t index 880fa3b..bea5085 100644 --- a/t/storage/on_connect_call.t +++ b/t/storage/on_connect_call.t @@ -10,7 +10,7 @@ use DBIx::Class::Storage::DBI; # !!! do not replace this with done_testing - tests reside in the callbacks # !!! number of calls is important -use Test::More tests => 11; +use Test::More tests => 16; # !!! my $schema = DBICTest::Schema->clone; @@ -78,3 +78,21 @@ my $schema = DBICTest::Schema->clone; $schema->storage->ensure_connected; $schema->storage->disconnect; # this should not fire any tests } + +{ + ok $schema->connection( + sub { DBI->connect(DBICTest->_database) }, + { + # method list form + on_connect_call => [ sub { ok 1, "on_connect_call after DT parser" }, ], + on_disconnect_call => [ sub { ok 1, "on_disconnect_call after DT parser" }, ], + }, + ), 'connection()'; + + ok (! $schema->storage->connected, 'start disconnected'); + + $schema->storage->_determine_driver; # this should connect due to the coderef + + ok ($schema->storage->connected, 'determine driver connects'); + $schema->storage->disconnect; +}