Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / t / storage / exception.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 use DBICTest;
10 use DBICTest::Schema;
11
12 # make sure nothing eats the exceptions (an unchecked eval in Storage::DESTROY used to be a problem)
13
14 {
15   package Dying::Storage;
16
17   use warnings;
18   use strict;
19
20   use base 'DBIx::Class::Storage::DBI';
21
22   sub _populate_dbh {
23     my $self = shift;
24
25     my $death = $self->_dbi_connect_info->[3]{die};
26
27     die "storage test died: $death" if $death eq 'before_populate';
28     my $ret = $self->next::method (@_);
29     die "storage test died: $death" if $death eq 'after_populate';
30
31     return $ret;
32   }
33 }
34
35 for (qw/before_populate after_populate/) {
36   throws_ok (sub {
37     my $schema = DBICTest::Schema->clone;
38     $schema->storage_type ('Dying::Storage');
39     $schema->connection (DBICTest->_database, { die => $_ });
40     $schema->storage->ensure_connected;
41   }, qr/$_/, "$_ exception found");
42 }
43
44 done_testing;