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