X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F68-inflate_has_a.t;h=37eac4bf7360fad77d19055d450426f10d237f59;hb=54a9a08890c1784af806b643a3671faf1312c2fc;hp=0019e293d049708c5ab7f24246ebd5a086ce7b6d;hpb=50891152d0b24649bfd67bdba97feec86b11c064;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi/68-inflate_has_a.t b/t/cdbi/68-inflate_has_a.t index 0019e29..37eac4b 100644 --- a/t/cdbi/68-inflate_has_a.t +++ b/t/cdbi/68-inflate_has_a.t @@ -1,22 +1,10 @@ +use DBIx::Class::Optional::Dependencies -skip_all_without => qw( ic_dt cdbicompat ); + use strict; use warnings; -use Test::More; - -BEGIN { - eval "use DBIx::Class::CDBICompat;"; - plan skip_all => "Class::Trigger and DBIx::ContextualFetch required" - if $@; - - eval { require DateTime }; - plan skip_all => "Need DateTime for inflation tests" if $@; - eval { require Clone }; - plan skip_all => "Need Clone for CDBICompat inflation tests" if $@; -} - -plan tests => 6; - -use lib qw(t/lib); +use Test::More; +use lib 't/lib'; use DBICTest; my $schema = DBICTest->init_schema(); @@ -27,7 +15,7 @@ DBICTest::Schema::CD->has_a( 'year', 'DateTime', inflate => sub { DateTime->new( year => shift ) }, deflate => sub { shift->year } ); -Class::C3->reinitialize; +Class::C3->reinitialize if DBIx::Class::_ENV_::OLD_MRO; # inflation test my $cd = $schema->resultset("CD")->find(3); @@ -41,7 +29,7 @@ my $now = DateTime->now; $cd->year( $now ); $cd->update; -($cd) = $schema->resultset("CD")->search( year => $now->year ); +($cd) = $schema->resultset("CD")->search({ year => $now->year }); is( $cd->year->year, $now->year, 'deflate ok' ); # re-test using alternate deflate syntax @@ -62,6 +50,7 @@ $now = DateTime->now; $cd->year( $now ); $cd->update; -($cd) = $schema->resultset("CD")->search( year => $now->year ); +($cd) = $schema->resultset("CD")->search({ year => $now->year }); is( $cd->year->year, $now->year, 'deflate ok' ); +done_testing;