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