X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2Fcolumns_as_hashes.t;h=f10f522c4ccff6f7e28492b9a5808d2eb2648a46;hb=c817eca810e0239e0a603bddefa8257bd2e914a7;hp=78066b293a74b4d868ec2881514d192c6c587b1b;hpb=de0ed7f1a05646ecf440d62d1423eaa46f5cd26b;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi/columns_as_hashes.t b/t/cdbi/columns_as_hashes.t index 78066b2..f10f522 100644 --- a/t/cdbi/columns_as_hashes.t +++ b/t/cdbi/columns_as_hashes.t @@ -1,13 +1,8 @@ use strict; +use warnings; use Test::More; use Test::Warn; -BEGIN { - eval "use DBIx::Class::CDBICompat;"; - plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") - : ('no_plan'); -} - use lib 't/cdbi/testlib'; use Film; @@ -53,15 +48,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 +69,7 @@ warning_is { return "movie" if lc $col eq "film"; return $col; }; - + require Actor; Actor->has_a( film => "Film" ); @@ -82,7 +77,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 +86,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;