use strict;
+use warnings;
use Test::More;
-
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- }
- plan tests => 24;
-}
+use Test::Exception;
+use DBIx::Class::_Util 'sigwarn_silencer';
@YA::Film::ISA = 'Film';
sub fail_with_bad_object {
my ($dir, $codir) = @_;
- eval {
+ throws_ok {
+ local $SIG{__WARN__} = sigwarn_silencer( qr/\Qusually should inherit from the related ResultClass ('Director')/ );
YA::Film->create(
{
Title => 'Tastes Bad',
NumExplodingSheep => 23
}
);
- };
- ok $@, $@;
+ } qr/isn't a Director/;
}
package Foo;
isa_ok($bar->fav, "Foo");
isa_ok($foo->fav, "Film");
-{
+{
my $foo;
Foo->add_trigger(after_create => sub { $foo = shift->fav });
my $gwh = Foo->create({ id => 93, fav => 'Good Will Hunting' });
isa_ok $foo, "Film", "Object in after_create trigger";
}
+done_testing;