use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
. ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
my $num_children = $ENV{DBICTEST_THREAD_STRESS} || 1;
if($num_children !~ /^[0-9]+$/ || $num_children < 10) {
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_sybase')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_sybase');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn);
+
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_sybase')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_sybase');
+
{
my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version};
ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') );
use DBICTest;
use Scope::Guard ();
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_FIREBIRD_${_}" } qw/DSN USER PASS/};
-my ($dsn2, $user2, $pass2) = @ENV{map { "DBICTEST_FIREBIRD_INTERBASE_${_}" } qw/DSN USER PASS/};
-my ($dsn3, $user3, $pass3) = @ENV{map { "DBICTEST_FIREBIRD_ODBC_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Test needs ' .
- (join ' or ', map { $_ ? $_ : () }
- DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_firebird'),
- DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_firebird_interbase'),
- DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_firebird_odbc'))
- unless
- $dsn && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_firebird')
- or
- $dsn2 && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_firebird_interbase')
- or
- $dsn3 && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_firebird_odbc')
- or
- (not $dsn || $dsn2 || $dsn3);
+my $env2optdep = {
+ DBICTEST_FIREBIRD => 'test_rdbms_firebird',
+ DBICTEST_FIREBIRD_INTERBASE => 'test_rdbms_firebird_interbase',
+ DBICTEST_FIREBIRD_ODBC => 'test_rdbms_firebird_odbc',
+};
+
+plan skip_all => join (' ',
+ 'Set $ENV{DBICTEST_FIREBIRD_DSN} and/or $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}',
+ 'and/or $ENV{DBICTEST_FIREBIRD_ODBC_DSN},',
+ '_USER and _PASS to run these tests.',
+
+ 'WARNING: this test creates and drops the tables "artist", "bindtype_test" and',
+ '"sequence_test"; the generators "gen_artist_artistid", "pkid1_seq", "pkid2_seq"',
+ 'and "nonpkid_seq" and the trigger "artist_bi".',
+) unless grep { $ENV{"${_}_DSN"} } keys %$env2optdep;
# tests stolen from 749sybase_asa.t
# Example ODBC DSN:
# dbi:ODBC:Driver=Firebird;Dbname=/var/lib/firebird/2.5/data/hlaghdb.fdb
-plan skip_all => <<'EOF' unless $dsn || $dsn2 || $dsn3;
-Set $ENV{DBICTEST_FIREBIRD_DSN} and/or $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}
-and/or $ENV{DBICTEST_FIREBIRD_ODBC_DSN},
-_USER and _PASS to run these tests.
-
-WARNING: this test creates and drops the tables "artist", "bindtype_test" and
-"sequence_test"; the generators "gen_artist_artistid", "pkid1_seq", "pkid2_seq"
-and "nonpkid_seq" and the trigger "artist_bi".
-EOF
-
-my @info = (
- [ $dsn, $user, $pass ],
- [ $dsn2, $user2, $pass2 ],
- [ $dsn3, $user3, $pass3 ],
-);
-
my $schema;
-foreach my $conn_idx (0..$#info) {
- my ($dsn, $user, $pass) = @{ $info[$conn_idx] || [] };
+for my $prefix (keys %$env2optdep) { SKIP: {
+
+ my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/;
next unless $dsn;
+ skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1)
+ unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix});
+
$schema = DBICTest::Schema->connect($dsn, $user, $pass, {
auto_savepoint => 1,
quote_char => q["],
};
}
}
-}
+}}
done_testing;
return $fire;
},
- ($ENV{DBICTEST_MEMCACHED})
- ? do {
- require Cache::Memcached;
- my $memcached = Cache::Memcached->new(
- { servers => [ $ENV{DBICTEST_MEMCACHED} ] } );
-
- my $key = 'tmp_dbic_84serialize_memcached_test';
-
- ( memcached => sub {
- $memcached->set( $key, $_[0], 60 );
- local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema;
- return $memcached->get($key);
- });
- } : ()
- ,
);
+if ($ENV{DBICTEST_MEMCACHED}) {
+ if (DBIx::Class::Optional::Dependencies->req_ok_for ('test_memcached')) {
+ my $memcached = Cache::Memcached->new(
+ { servers => [ $ENV{DBICTEST_MEMCACHED} ] }
+ );
+
+ my $key = 'tmp_dbic_84serialize_memcached_test';
+
+ $stores{memcached} = sub {
+ $memcached->set( $key, $_[0], 60 );
+ local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema;
+ return $memcached->get($key);
+ };
+ }
+ else {
+ SKIP: {
+ skip 'Memcached tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_memcached'), 1;
+ }
+ }
+}
+else {
+ SKIP: {
+ skip 'Set $ENV{DBICTEST_MEMCACHED} to run the memcached serialization tests', 1;
+ }
+}
+
+
+
for my $name (keys %stores) {
my $store = $stores{$name};
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')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy');
+
+ plan skip_all =>
+ 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mysql')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql');
}
use_ok('DBICVersion_v1');
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});
-
-plan tests => 3;
-
use lib 't/cdbi/testlib';
use_ok ('Log');
ok eval { $log->datetime_stamp }, "Have datetime after update";
diag $@ if $@;
+done_testing;
# 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',
our $dbh;
+my $err;
+if (! $ENV{DBICTEST_MYSQL_DSN} ) {
+ $err = 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test';
+}
+elsif ( ! DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql') ) {
+ $err = 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mysql')
+}
+
+if ($err) {
+ my $t = eval { Test::Builder->new };
+ if ($t and ! $t->current_test) {
+ $t->skip_all ($err);
+ }
+ else {
+ die "$err\n";
+ }
+}
+
my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0});
$dbh = DBI->connect(@connect) or die DBI->errstr;
my @table;