From: Fabrice Gabolde Date: Wed, 13 Apr 2016 13:42:38 +0000 (+0200) Subject: Unit tests for the fix. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fghpr%2Fapplied%2Fas_e7dcdf69;p=dbsrgits%2FDBIx-Class-Historic.git Unit tests for the fix. --- diff --git a/t/94versioning.t b/t/94versioning.t index ab9d261..78aaa12 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}; }