From c1d991f1d2a2fc43563624fe13232209b6c651f2 Mon Sep 17 00:00:00 2001 From: Fabrice Gabolde Date: Wed, 13 Apr 2016 15:42:38 +0200 Subject: [PATCH] Unit tests for the fix. --- t/94versioning.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/t/94versioning.t b/t/94versioning.t index ab9d2613e..78aaa1215 100644 --- a/t/94versioning.t +++ b/t/94versioning.t @@ -281,6 +281,29 @@ is ), 3, "Expected number of connections at end of script" ; +# try to setup a custom error handle without unsafe set -- should +# fail, same behavior as regular Schema +throws_ok(sub { + my $schema = DBICVersion::Schema->connect( + $dsn, $user, $pass, + { HandleError => sub { die $_[0] }, + ignore_version => 1 }); + $schema->deploy(); + }, + qr/Refusing clobbering of \{HandleError\} installed on externally supplied DBI handle/, + q{HandleError with unsafe not set causes an exception}); + +# now try it with unsafe set -- should work (see RT #113741) +lives_ok(sub { + my $schema = DBICVersion::Schema->connect( + $dsn, $user, $pass, + { HandleError => sub { die $_[0] }, + unsafe => 1, + ignore_version => 1 }); + $schema->deploy(); + }, + q{HandleError with unsafe set works}); + END { rm_rf $ddl_dir unless $ENV{DBICTEST_KEEP_VERSIONING_DDL}; }