use strict;
use warnings;
+# !!! do not replace this with done_testing - tests reside in the callbacks
+# !!! number of calls is important
use Test::More tests => 12;
+# !!!
+use Test::Exception;
use lib qw(t/lib);
use base 'DBICTest';
+require DBI;
my $schema = DBICTest->init_schema(
$schema->storage->disconnect;
ok $schema->connection(
- DBICTest->_database,
+ sub { DBI->connect(DBICTest->_database) },
{
on_connect_do => [
'CREATE TABLE TEST_empty (id INTEGER)',
[ [ 2 ], [ 3 ], [ 7 ] ],
'on_connect_do() worked'
);
-eval { $schema->storage->dbh->do('SELECT 1 FROM TEST_nonexistent'); };
-ok $@, 'Searching for nonexistent table dies';
+dies_ok {
+ $schema->storage->dbh->do('SELECT 1 FROM TEST_nonexistent');
+} 'Searching for nonexistent table dies';
$schema->storage->disconnect();
sub check_dropped {
my $storage = shift;
- eval { $storage->dbh->do('SELECT 1 FROM TEST_empty'); };
- ok $@, 'Reading from dropped table fails';
+
+ dies_ok {
+ $storage->dbh->do('SELECT 1 FROM TEST_empty');
+ } 'Reading from dropped table fails';
return;
}