10 use_ok( 'DBICTest::Schema' );
12 my $schema = DBICTest->init_schema;
14 my $e_start = quotemeta('DBIx::Class::');
19 $schema->resultset('CD')->create({ title => 'vacation in antarctica' })
21 qr/$e_start.+constraint failed.+NULL/s
22 ); # as opposed to some other error
23 }, [], 'No warnings besides exception' );
25 my $dbh = $schema->storage->dbh;
29 $dbh->do ('INSERT INTO nonexistent_table VALUES (1)')
31 qr/$e_start.+DBI Exception.+no such table/,
32 'DBI exceptions properly handled by dbic-installed callback'
35 # This usage is a bit unusual but it was actually seen in the wild
36 # destruction of everything except the $dbh should use the proper
40 # These explicit disconnections on loss of $storage don't seem
41 # right... disable it here for the test anyway
43 local $dbh->{Callbacks}{disconnect} = sub { 1 };
48 $dbh->do ('INSERT INTO nonexistent_table VALUES (1)')
50 qr/DBI Exception.+unhandled by DBIC.+no such table/,
51 'callback works after $schema is gone'