Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / t / storage / exception.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
d0c7015c 3use strict;
4use warnings;
5
6use Test::More;
7use Test::Exception;
c0329273 8
d0c7015c 9use DBICTest;
10use 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;
3b80fa31 24
d0c7015c 25 my $death = $self->_dbi_connect_info->[3]{die};
26
014fd556 27 die "storage test died: $death" if $death eq 'before_populate';
d0c7015c 28 my $ret = $self->next::method (@_);
014fd556 29 die "storage test died: $death" if $death eq 'after_populate';
d0c7015c 30
31 return $ret;
32 }
33}
34
d0c7015c 35for (qw/before_populate after_populate/) {
3b80fa31 36 throws_ok (sub {
d0c7015c 37 my $schema = DBICTest::Schema->clone;
38 $schema->storage_type ('Dying::Storage');
39 $schema->connection (DBICTest->_database, { die => $_ });
40 $schema->storage->ensure_connected;
3b80fa31 41 }, qr/$_/, "$_ exception found");
d0c7015c 42}
43
d0c7015c 44done_testing;