from tests (RT#59565)
- Do not execute t/zzzzzzz_sqlite_deadlock.t for regular module
installs - test is prone to spontaneous blow up
+ - DT-related tests now require a DateTime >= 0.55 (RT#60324)
0.08123 2010-06-12 14:46 (UTC)
* Fixes
# Makefile.PL in $AUTHOR mode
my $moose_basic = {
- 'Moose' => '0.98',
- 'MooseX::Types' => '0.21',
+ 'Moose' => '0.98',
+ 'MooseX::Types' => '0.21',
+};
+
+my $replicated = {
+ %$moose_basic,
+ 'Hash::Merge' => '0.12',
};
my $admin_basic = {
%$moose_basic,
- 'MooseX::Types::Path::Class' => '0.05',
- 'MooseX::Types::JSON' => '0.02',
- 'JSON::Any' => '1.22',
- 'namespace::autoclean' => '0.09',
+ 'MooseX::Types::Path::Class' => '0.05',
+ 'MooseX::Types::JSON' => '0.02',
+ 'JSON::Any' => '1.22',
+ 'namespace::autoclean' => '0.09',
+};
+
+my $datetime_basic = {
+ 'DateTime' => '0.55',
+ 'DateTime::Format::Strptime' => '1.2',
};
my $reqs = {
},
replicated => {
- req => {
- %$moose_basic,
- 'Hash::Merge' => '0.12',
- },
+ req => $replicated,
pod => {
title => 'Storage::Replicated',
desc => 'Modules required for L<DBIx::Class::Storage::DBI::Replicated>',
},
},
+ test_replicated => {
+ req => {
+ %$replicated,
+ 'Test::Moose' => '0',
+ },
+ },
+
+
admin => {
req => {
%$admin_basic,
},
},
- test_dtrelated => {
+ test_dt => {
+ req => $datetime_basic,
+ },
+
+ test_dt_sqlite => {
req => {
+ %$datetime_basic,
# t/36datetime.t
# t/60core.t
'DateTime::Format::SQLite' => '0',
+ },
+ },
- # t/96_is_deteministic_value.t
- 'DateTime::Format::Strptime'=> '0',
-
+ test_dt_mysql => {
+ req => {
+ %$datetime_basic,
# t/inflate/datetime_mysql.t
# (doesn't need Mysql itself)
- 'DateTime::Format::MySQL' => '0',
+ 'DateTime::Format::MySQL' => '0',
+ },
+ },
+ test_dt_pg => {
+ req => {
+ %$datetime_basic,
# t/inflate/datetime_pg.t
# (doesn't need PG itself)
- 'DateTime::Format::Pg' => '0',
+ 'DateTime::Format::Pg' => '0',
},
},
- cdbicompat => {
+ test_cdbicompat => {
req => {
'DBIx::ContextualFetch' => '0',
'Class::DBI::Plugin::DeepAbstractSearch' => '0',
},
},
- rdbms_pg => {
+ test_rdbms_pg => {
req => {
$ENV{DBICTEST_PG_DSN}
? (
},
},
- rdbms_mysql => {
+ test_rdbms_mysql => {
req => {
$ENV{DBICTEST_MYSQL_DSN}
? (
},
},
- rdbms_oracle => {
+ test_rdbms_oracle => {
req => {
$ENV{DBICTEST_ORA_DSN}
? (
},
},
- rdbms_ase => {
+ test_rdbms_ase => {
req => {
$ENV{DBICTEST_SYBASE_DSN}
? (
},
},
- rdbms_asa => {
- req => {
- (scalar grep { $ENV{$_} } (qw/DBICTEST_SYBASE_ASA_DSN DBICTEST_SYBASE_ASA_ODBC_DSN/) )
- ? (
- 'DateTime::Format::Strptime' => 0,
- ) : ()
- },
- },
-
- rdbms_db2 => {
+ test_rdbms_db2 => {
req => {
$ENV{DBICTEST_DB2_DSN}
? (
BEGIN {
require DBIx::Class;
- plan skip_all => 'Test needs '
- . DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
- use_ok('DBIx::Class::ResultSource::View');
+ plan skip_all => 'Test needs ' .
+ DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
}
+use_ok('DBIx::Class::ResultSource::View');
+
#################### SANITY
my $view = DBIx::Class::ResultSource::View->new;
use lib qw(t/lib);
BEGIN {
- eval { require Class::Inspector };
- if ($@ =~ m{Can.t locate Class/Inspector.pm}) {
- plan skip_all => "ResultSetManager requires Class::Inspector";
- } else {
- plan tests => 4;
- }
-}
-
-BEGIN {
local $SIG{__WARN__} = sub {};
require DBIx::Class::ResultSetManager;
}
-use DBICTest::ResultSetManager; # uses Class::Inspector
+use DBICTest::ResultSetManager;
my $schema = DBICTest::ResultSetManager->compose_namespace('DB');
my $rs = $schema->resultset('Foo');
ok( $rs->can('bar'), 'Foo resultset class has bar method' );
isa_ok( $rs, 'DBICTest::ResultSetManager::Foo::_resultset', 'Foo resultset class is correct' );
is( $rs->bar, 'good', 'bar method works' );
+
+done_testing;
use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
# Check that datetime_parser returns correctly before we explicitly connect.
SKIP: {
- eval { require DateTime::Format::Pg };
- skip "DateTime::Format::Pg required", 2 if $@;
+ skip (
+ "Pg parser detection test needs " . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg'),
+ 2
+ ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg');
my $store = ref $s->storage;
is($store, 'DBIx::Class::Storage::DBI', 'Started with generic storage');
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
use strict;
-use warnings;
+use warnings;
no warnings 'uninitialized';
use Test::More;
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
my $schema = DBICTest->init_schema();
-eval "use DBD::SQLite";
-plan skip_all => 'needs DBD::SQLite for testing' if $@;
-plan tests => 4;
-
cmp_ok($schema->resultset("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
{ join => 'artist' }),
'==', 3, 'Count by has_a ok');
{ join => [ qw/tags liner_notes/ ] } ),
'==', 2, "Mixed count ok");
+done_testing;
use strict;
-use warnings;
-
-# Copied from 71mysql.t, manually using NoBindVars. This is to give that code
-# wider testing, since virtually nobody who regularly runs the test suite
-# is using DBD::Sybase+FreeTDS+MSSQL -- blblack
+use warnings;
use Test::More;
use lib qw(t/lib);
plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 4;
-
{ # Fake storage driver for mysql + no bind variables
package DBIx::Class::Storage::DBI::MySQLNoBindVars;
use Class::C3;
my $dbh = eval { $schema->storage->_dbh };
$dbh->do("DROP TABLE artist") if $dbh;
}
+
+done_testing;
use strict;
use warnings;
+
use Test::More;
use Test::Warn;
use Test::Exception;
-use Path::Class;
-use File::Copy;
-
-#warn "$dsn $user $pass";
my ($dsn, $user, $pass);
BEGIN {
plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn);
- eval { require Time::HiRes }
- || plan skip_all => 'Test needs Time::HiRes';
- Time::HiRes->import(qw/time sleep/);
-
require DBIx::Class;
plan skip_all =>
'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
}
+use Path::Class;
+use File::Copy;
+use Time::HiRes qw/time sleep/;
+
use lib qw(t/lib);
use DBICTest; # do not remove even though it is not used
use strict;
use warnings;
-# 6 tests
-
use Test::More;
+use Test::Exception;
+
+BEGIN {
+ require DBIx::Class;
+ plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+}
+
use lib qw(t/lib);
use DBICTest;
-plan skip_all => "DateTime required" unless eval { require DateTime };
-eval "use DateTime::Format::Strptime";
-plan skip_all => 'DateTime::Format::Strptime required' if $@;
-use Test::Exception;
my $schema = DBICTest->init_schema();
my $artist_rs = $schema->resultset('Artist');
use warnings;
use Test::More;
-use lib qw(t/lib);
-use DBICTest;
-use DBICTest::Stats;
my ($create_sql, $dsn, $user, $pass);
plan skip_all => 'Set DBICTEST_(PG|MYSQL)_DSN _USER and _PASS if you want to run savepoint tests';
}
+use lib qw(t/lib);
+use DBICTest;
+use DBICTest::Stats;
+
plan tests => 16;
my $schema = DBICTest::Schema->connect ($dsn,$user,$pass,{ auto_savepoint => 1 });
use Test::More;
use Test::Exception;
-use lib qw(t/lib);
-use DBICTest;
-use DBICTest::Schema;
use Scalar::Util ();
BEGIN {
unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
}
+use lib qw(t/lib);
+use DBICTest;
+use DBICTest::Schema;
+
# Test for SQLT-related leaks
{
my $s = DBICTest::Schema->clone;
use warnings;
use Test::More;
-
use Test::Exception;
BEGIN {
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
plan tests => 98;
}
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6);
+ plan tests => 6;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 24);
+ plan tests => 24;
}
@YA::Film::ISA = 'Film';
BEGIN {
eval "use DBIx::Class::CDBICompat;";
plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 31);
+ plan tests => 31;
}
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 13);
+ plan tests => 13;
}
use lib 't/cdbi/testlib';
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 50);
+ plan tests => 50;
}
use lib 't/cdbi/testlib';
# make sure nothing gets clobbered;
test_normal_iterator;
-SKIP: {
- #skip "dbic iterators don't support slice yet", 12;
-
-
{
my @acts = $film->actors->slice(1, 2);
is @acts, 2, "Slice gives 2 actor";
eval { $film->actors->delete_all };
is $@, '', "Deleting again does no harm";
}
-
-} # end SKIP block
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 23);
+ plan tests => 23;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 22);
+ plan tests => 22;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 75);
+ plan tests => 75;
}
INIT {
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5);
+ plan tests => 5;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 41);
+ plan tests => 41;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 20);
+ plan tests => 20;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 37);
+ plan tests => 37;
}
use lib 't/cdbi/testlib';
use Test::More;
-eval "use DBIx::Class::CDBICompat;";
+eval "use DBIx::Class::CDBICompat; use Time::Piece::MySQL;";
if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- next;
+ plan (skip_all => "Time::Piece::MySQL, Class::Trigger and DBIx::ContextualFetch required: $@");
}
plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
unless ($ENV{DBICTEST_MYSQL_DSN} && $ENV{DBICTEST_MYSQL_USER});
-eval { require Time::Piece::MySQL };
-plan skip_all => "Need Time::Piece::MySQL for this test" if $@;
-
plan tests => 3;
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 12);
+ plan tests => 12;
}
INIT {
use Test::More;
BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
+ eval "use DBIx::Class::CDBICompat;use Time::Piece;";
+ plan skip_all => "Time::Piece, Class::Trigger and DBIx::ContextualFetch required: $@"
if $@;
- plan skip_all => "Time::Piece required for this test"
- unless eval { require Time::Piece };
-
plan tests => 12;
}
eval "use DBIx::Class::CDBICompat;";
plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
if $@;
-}
-
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? (skip_all => 'needs DBD::SQLite for testing')
- : (tests => 6);
+ plan tests => 6;
}
use lib 't/cdbi/testlib';
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6);
+ plan tests => 6;
}
use lib 't/cdbi/testlib';
use Test::More;
BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required"
+ eval "use DBIx::Class::CDBICompat; use DateTime 0.55; use Clone;";
+ plan skip_all => "Clone, DateTime 0.55, 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;
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 7);
+ plan tests => 7;
}
use lib 't/cdbi/testlib';
use Test::More;
BEGIN {
- eval "use DBIx::Class::CDBICompat;";
+ eval "use DBIx::Class::CDBICompat; require Class::DBI::Plugin::DeepAbstractSearch;";
if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- next;
+ plan (skip_all => "Class::DBI::Plugin::DeepAbstractSearch, Class::Trigger and DBIx::ContextualFetch required: $@");
}
-
- plan skip_all => 'needs DBD::SQLite for testing'
- unless eval { require DBD::SQLite };
-
- plan skip_all => 'needs Class::DBI::Plugin::DeepAbstractSearch'
- unless eval { require Class::DBI::Plugin::DeepAbstractSearch };
-
plan tests => 19;
}
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10);
+ plan tests => 10;
}
INIT {
BEGIN {
eval "use DBIx::Class::CDBICompat;";
plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 3);
+ plan tests => 3;
}
eval "use DBIx::Class::CDBICompat;";
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 2);
+ plan tests => 2;
}
use lib 't/cdbi/testlib';
BEGIN {
eval "use DBIx::Class::CDBICompat;";
plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
-
- eval "use DBD::SQLite";
- plan skip_all => 'needs DBD::SQLite for testing' if $@;
}
INIT {
if ($@) {
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
}
-
- eval "use DBD::SQLite";
- plan skip_all => 'needs DBD::SQLite for testing' if $@;
}
INIT {
use lib 't/cdbi/testlib';
BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
+ eval "use DBIx::Class::CDBICompat;use DateTime 0.55;";
+ plan skip_all => "DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required: $@"
if $@;
- plan skip_all => "DateTime required" unless eval { require DateTime };
plan tests => 2;
}
use lib 't/cdbi/testlib';
BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
+ eval "use DBIx::Class::CDBICompat;use DateTime 0.55;";
+ plan skip_all => "DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required: $@"
if $@;
- plan skip_all => "DateTime required" unless eval { require DateTime };
plan tests => 1;
}
plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
next;
}
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10);
+ plan tests => 10;
}
use lib 't/lib';
my $schema = DBICTest->init_schema();
-eval { require DateTime };
-plan skip_all => "Need DateTime for inflation tests" if $@;
+plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
$schema->class('CD') ->inflate_column( 'year',
{ inflate => sub { DateTime->new( year => shift ) },
is( $cd->year->month, 1, 'inflated month ok' );
-eval { $cd->year(\'year +1'); };
-ok(!$@, 'updated year using a scalarref');
+lives_ok (
+ sub { $cd->year(\'year +1') },
+ 'updated year using a scalarref'
+);
$cd->update();
$cd->discard_changes();
is( $cd->year->year, $now->year, 'deflate ok' );
# set_inflated_column test
-eval { $cd->set_inflated_column('year', $now) };
-ok(!$@, 'set_inflated_column with DateTime object');
+lives_ok (
+ sub { $cd->set_inflated_column('year', $now) },
+ 'set_inflated_column with DateTime object'
+);
$cd->update;
$cd = $rs->find(3);
$cd = $rs->find(3);
my $before_year = $cd->year->year;
-eval { $cd->set_inflated_column('year', \'year + 1') };
-ok(!$@, 'set_inflated_column to "year + 1"');
+lives_ok (
+ sub { $cd->set_inflated_column('year', \'year + 1') },
+ 'set_inflated_column to "year + 1"',
+);
$cd->update;
$cd->store_inflated_column('year', \'year + 1');
# store_inflated_column test
$cd = $rs->find(3);
-eval { $cd->store_inflated_column('year', $now) };
-ok(!$@, 'store_inflated_column with DateTime object');
+lives_ok (
+ sub { $cd->store_inflated_column('year', $now) },
+ 'store_inflated_column with DateTime object'
+);
$cd->update;
is( $cd->year->year, $now->year, 'deflate ok' );
# update tests
$cd = $rs->find(3);
-eval { $cd->update({'year' => $now}) };
-ok(!$@, 'update using DateTime object ok');
+lives_ok (
+ sub { $cd->update({'year' => $now}) },
+ 'update using DateTime object ok'
+);
is($cd->year->year, $now->year, 'deflate ok');
$cd = $rs->find(3);
$before_year = $cd->year->year;
-eval { $cd->update({'year' => \'year + 1'}) };
-ok(!$@, 'update using scalarref ok');
+lives_ok (
+ sub { $cd->update({'year' => \'year + 1'}) },
+ 'update using scalarref ok'
+);
$cd = $rs->find(3);
is($cd->year->year, $before_year + 1, 'deflate ok');
my $schema = DBICTest->init_schema();
-eval { require DateTime::Format::SQLite };
-plan $@
- ? ( skip_all => "Need DateTime::Format::SQLite for DT inflation tests" )
- : ( tests => 18 )
-;
+plan skip_all => 'DT inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
# inflation test
my $event = $schema->resultset("Event")->find(1);
## skip inflation field
my $skip_inflation = $event->skip_inflation;
is ("$skip_inflation", '2006-04-21 18:04:06', 'Correct date/time');
+
+done_testing;
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
use DBICTest;
-eval { require DateTime::Format::SQLite };
-plan $@ ? ( skip_all => 'Requires DateTime::Format::SQLite' )
- : ( tests => 3 );
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_sqlite')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_sqlite');
my $schema = DBICTest->init_schema(
no_deploy => 1, # Deploying would cause an early rebless
is($parser, 'DateTime::Format::SQLite', 'Got expected storage-set datetime_parser');
isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::SQLite', 'storage');
+done_testing;
use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
_USER and _PASS to run this test'.
Warning: This test drops and creates a table called 'event'";
EOF
-} else {
- eval "use DateTime; use DateTime::Format::Strptime;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
- }
}
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+
my @info = (
[ $dsn, $user, $pass ],
[ $dsn2, $user2, $pass2 ],
use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
Set $ENV{DBICTEST_INFORMIX_DSN} _USER and _PASS to run this test'.
Warning: This test drops and creates a table called 'event'";
EOF
-} else {
- eval "use DateTime; use DateTime::Format::Strptime;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
- }
}
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+
my $schema;
{
'Set $ENV{DBICTEST_MSSQL_ODBC_DSN} and/or $ENV{DBICTEST_MSSQL_DSN} _USER '
.'and _PASS to run this test' .
"\nWarning: This test drops and creates a table called 'track'";
-} else {
- eval "use DateTime; use DateTime::Format::Strptime;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
- }
}
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+
my @connect_info = (
[ $dsn, $user, $pass ],
[ $dsn2, $user2, $pass2 ],
use Test::More;
use Test::Exception;
+use Test::Warn;
use lib qw(t/lib);
use DBICTest;
use DBICTest::Schema;
+plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_mysql')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_mysql');
+
{
local $SIG{__WARN__} = sub { warn @_ if $_[0] !~ /extra \=\> .+? has been deprecated/ };
DBICTest::Schema->load_classes('EventTZ');
DBICTest::Schema->load_classes('EventTZDeprecated');
}
-eval { require DateTime::Format::MySQL };
-plan $@
- ? ( skip_all => "Need DateTime::Format::MySQL for inflation tests")
- : ( tests => 33 )
-;
-
my $schema = DBICTest->init_schema();
# Test "timezone" parameter
# Test floating timezone warning
# We expect one warning
SKIP: {
- skip "ENV{DBIC_FLOATING_TZ_OK} was set, skipping", 1 if $ENV{DBIC_FLOATING_TZ_OK};
- local $SIG{__WARN__} = sub {
- like(
- shift,
- qr/You're using a floating timezone, please see the documentation of DBIx::Class::InflateColumn::DateTime for an explanation/,
- 'Floating timezone warning'
- );
- };
- my $event_tz_floating = $schema->resultset($tbl)->create({
- starts_at => DateTime->new(year=>2007, month=>12, day=>31, ),
- created_on => DateTime->new(year=>2006, month=>1, day=>31,
- hour => 13, minute => 34, second => 56, ),
- });
- delete $SIG{__WARN__};
+ skip "ENV{DBIC_FLOATING_TZ_OK} was set, skipping", 1 if $ENV{DBIC_FLOATING_TZ_OK};
+ warnings_exist (
+ sub {
+ $schema->resultset($tbl)->create({
+ starts_at => DateTime->new(year=>2007, month=>12, day=>31 ),
+ created_on => DateTime->new(year=>2006, month=>1, day=>31, hour => 13, minute => 34, second => 56 ),
+ });
+ },
+ qr/You're using a floating timezone, please see the documentation of DBIx::Class::InflateColumn::DateTime for an explanation/,
+ 'Floating timezone warning'
+ );
};
# This should fail to set
qr/invalid date format/i,
"Invalid date format exception"
);
+
+done_testing;
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test. ' .
'Warning: This test drops and creates a table called \'track\'';
}
-else {
- eval "use DateTime; use DateTime::Format::Oracle;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing';
- }
- else {
- plan tests => 10;
- }
-}
+
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
# DateTime::Format::Oracle needs this set
$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
is( int $track->last_updated_at->nanosecond, int 500_000_000,
'TIMESTAMP nanoseconds survived' );
+done_testing;
+
# clean up our mess
END {
if($schema && ($dbh = $schema->storage->dbh)) {
use lib qw(t/lib);
use DBICTest;
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg');
+
{
local $SIG{__WARN__} = sub { warn @_ if $_[0] !~ /extra \=\> .+? has been deprecated/ };
DBICTest::Schema->load_classes('EventTZPg');
}
-eval { require DateTime::Format::Pg };
-plan $@
- ? ( skip_all => 'Need DateTime::Format::Pg for timestamp inflation tests')
- : ( tests => 6 )
-;
-
-
my $schema = DBICTest->init_schema();
{
is($event->ts_without_tz->microsecond, $dt->microsecond,
'timestamp without time zone microseconds survived');
}
+
+done_testing;
use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
plan skip_all =>
'Set $ENV{DBICTEST_SYBASE_DSN}, _USER and _PASS to run this test' .
"\nWarning: This test drops and creates a table called 'track'";
-} else {
- eval "use DateTime; use DateTime::Format::Sybase;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Sybase for testing';
- }
}
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_ase')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_ase');
+
my @storage_types = (
'DBI::Sybase::ASE',
'DBI::Sybase::ASE::NoBindVars',
# minute precision
['SMALLDATETIME', 'small_dt', '2004-08-21T14:36:00.000Z'],
);
-
+
for my $dt_type (@dt_types) {
my ($type, $col, $sample_dt) = @$dt_type;
_USER and _PASS to run this test'.
Warning: This test drops and creates a table called 'track'";
EOF
-} else {
- eval "use DateTime; use DateTime::Format::Strptime;";
- if ($@) {
- plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
- }
}
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
+
my @info = (
[ $dsn, $user, $pass ],
[ $dsn2, $user2, $pass2 ],
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
);
SKIP: {
- eval { require DateTime };
- skip "Need DateTime for +select/get_inflated_columns tests", 1 if $@;
+ 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 ) },
use strict;
use warnings;
-use lib qw(t/lib);
+
use Test::More;
+
+BEGIN {
+ require DBIx::Class;
+ plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_replicated')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_replicated');
+}
+
+use Test::Moose;
use Test::Exception;
-use DBICTest;
use List::Util 'first';
use Scalar::Util 'reftype';
use File::Spec;
use IO::Handle;
+use Moose();
+use MooseX::Types();
+note "Using Moose version $Moose::VERSION and MooseX::Types version $MooseX::Types::VERSION";
-BEGIN {
- eval { require Test::Moose; Test::Moose->import() };
- plan skip_all => "Need Test::Moose to run this test" if $@;
- require DBIx::Class;
-
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('replicated')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('replicated');
-}
+use lib qw(t/lib);
+use DBICTest;
use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool';
use_ok 'DBIx::Class::Storage::DBI::Replicated::Balancer';
use_ok 'DBIx::Class::Storage::DBI::Replicated::Replicant';
use_ok 'DBIx::Class::Storage::DBI::Replicated';
-use Moose();
-use MooseX::Types();
-note "Using Moose version $Moose::VERSION and MooseX::Types version $MooseX::Types::VERSION";
=head1 HOW TO USE