X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fon_connect_call.t;h=265835cc2129487eee0f4c0c45a69c9e38326ffe;hb=3b80fa31b60050d4c8df91457ba6fd51b579a7a6;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..265835c 100644 --- a/t/storage/on_connect_call.t +++ b/t/storage/on_connect_call.t @@ -10,8 +10,9 @@ 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 => 17; # !!! +use Test::Warn; my $schema = DBICTest::Schema->clone; @@ -78,3 +79,24 @@ 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, undef, undef, { AutoCommit => 0 } ) }, + { + # 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'); + + # this should connect due to the coderef, and also warn due to the false autocommit above + warnings_exist { + $schema->storage->_determine_driver + } qr/The 'RaiseError' of the externally supplied DBI handle is set to false/, 'Warning on clobbered AutoCommit => 0 fired'; + + ok ($schema->storage->connected, 'determine driver connects'); + $schema->storage->disconnect; +}