From: Peter Rabbitson Date: Sat, 7 Feb 2015 16:02:02 +0000 (+0100) Subject: Remove DateTime requirement from tests that do not rely on it X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1f5d74aede2664925523a61d97b4f014eef3c351;p=dbsrgits%2FDBIx-Class-Historic.git Remove DateTime requirement from tests that do not rely on it The deterministic_value test checks how stringification behaves wrt inherited values from a resultset. Rename test while we are at it. The plus_select.t checks behavior of InflateColumn combined with get_columns. In both cases the column in question (year) is declared as VarChar and is not connected with IC::DT in any way Read under -C -C -M -w --- diff --git a/t/96_is_deteministic_value.t b/t/resultset/create_with_rs_inherited_values.t similarity index 79% rename from t/96_is_deteministic_value.t rename to t/resultset/create_with_rs_inherited_values.t index 330d294..8a0acd3 100644 --- a/t/96_is_deteministic_value.t +++ b/t/resultset/create_with_rs_inherited_values.t @@ -1,10 +1,9 @@ -use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt'; - use strict; use warnings; use Test::More; use Test::Exception; +use Math::BigInt; use lib qw(t/lib); use DBICTest; @@ -26,9 +25,8 @@ my $cd_rs = $schema->resultset('CD'); } { - my $formatter = DateTime::Format::Strptime->new(pattern => '%Y'); - my $dt = DateTime->new(year => 2006, month => 06, day => 06, - formatter => $formatter ); + my $dt = Math::BigInt->new(2006); + my $cd; lives_ok { $cd = $cd_rs->search({ year => $dt})->create diff --git a/t/resultset/plus_select.t b/t/resultset/plus_select.t index 4f082f5..db55ac4 100644 --- a/t/resultset/plus_select.t +++ b/t/resultset/plus_select.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Math::BigInt; use lib qw(t/lib); use DBICTest; @@ -42,24 +43,18 @@ is_deeply ( 'extra columns returned by get_inflated_columns without inflatable columns', ); -SKIP: { - skip ( - "+select/get_inflated_columns tests need " . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt'), - 1 - ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt'); - - $schema->class('CD')->inflate_column( 'year', - { inflate => sub { DateTime->new( year => shift ) }, - deflate => sub { shift->year } } - ); +# Test object inflation +$schema->class('CD')->inflate_column( 'year', + { inflate => sub { Math::BigInt->new( shift ) }, + deflate => sub { shift() . '' } } +); - $basecols{year} = DateTime->new ( year => $basecols{year} ); +$basecols{year} = Math::BigInt->new( $basecols{year} ); - is_deeply ( - { $plus_rs->first->get_inflated_columns, %todo_rel_inflation_override }, - { %basecols, tr_cnt => $track_cnt }, - 'extra columns returned by get_inflated_columns', - ); -} +is_deeply ( + { $plus_rs->first->get_inflated_columns, %todo_rel_inflation_override }, + { %basecols, tr_cnt => $track_cnt }, + 'extra columns returned by get_inflated_columns', +); done_testing;