X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2Fcolumns_as_hashes.t;h=5e2d83c8e7b67acae8e40a87ff8a47d6b9b75e7c;hb=94f9fbefc7e247e2319b2472787e974fcf8cbb97;hp=78066b293a74b4d868ec2881514d192c6c587b1b;hpb=de0ed7f1a05646ecf440d62d1423eaa46f5cd26b;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi/columns_as_hashes.t b/t/cdbi/columns_as_hashes.t index 78066b2..5e2d83c 100644 --- a/t/cdbi/columns_as_hashes.t +++ b/t/cdbi/columns_as_hashes.t @@ -4,8 +4,7 @@ use Test::Warn; BEGIN { eval "use DBIx::Class::CDBICompat;"; - plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") - : ('no_plan'); + plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@" if $@; } use lib 't/cdbi/testlib'; @@ -53,15 +52,15 @@ warning_is { } '', 'DBIC_CDBICOMPAT_HASH_WARN controls warnings'; -{ +{ $waves->rating("R"); $waves->update; - + no warnings 'redefine'; local *Film::rating = sub { return "wibble"; }; - + is $waves->{rating}, "R"; } @@ -74,7 +73,7 @@ warning_is { return "movie" if lc $col eq "film"; return $col; }; - + require Actor; Actor->has_a( film => "Film" ); @@ -82,7 +81,7 @@ warning_is { name => 'Emily Watson', film => $waves, }); - + ok !eval { $actor->film }; is $actor->{film}->id, $waves->id, 'hash access still works despite lack of accessor'; @@ -91,14 +90,19 @@ warning_is { # Emulate that Class::DBI inflates immediately SKIP: { - skip "Need MySQL to run this test", 3 unless eval { require MyFoo }; - + unless (eval { require MyFoo }) { + my ($err) = $@ =~ /([^\n]+)/; + skip $err, 3 + } + my $foo = MyFoo->insert({ name => 'Whatever', tdate => '1949-02-01', }); isa_ok $foo, 'MyFoo'; - + isa_ok $foo->{tdate}, 'Date::Simple'; is $foo->{tdate}->year, 1949; -} \ No newline at end of file +} + +done_testing;