X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F10_08sqlanywhere_common.t;fp=t%2F10_08sqlanywhere_common.t;h=da9837b4afe1108e067d6ec733c92f62fb830dca;hb=ffd4ce367abb2ebc8bfa611e091b5f3b181ab795;hp=6f1f58e8f37ae3c6f5075d5961de882b601ce363;hpb=b4e3cc291e2b1c6efe12dd4f9166849e07a57dac;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/10_08sqlanywhere_common.t b/t/10_08sqlanywhere_common.t index 6f1f58e..da9837b 100644 --- a/t/10_08sqlanywhere_common.t +++ b/t/10_08sqlanywhere_common.t @@ -20,24 +20,30 @@ use constant EXTRA_DUMP_DIR => "$tdir/sqlanywhere_extra_dump"; # # Setting them to zero is preferred. -my %dsns; -for (qw(SQLANYWHERE SQLANYWHERE_ODBC)) { - next unless $ENV{"DBICTEST_${_}_DSN"}; +my %env2optdep = map { $_ => lc "test_rdbms_$_" } qw(SQLANYWHERE SQLANYWHERE_ODBC); + +plan skip_all => 'requirements not satisfied: ' . (join ' OR ', map + { "[ @{[ DBIx::Class::Schema::Loader::Optional::Dependencies->req_missing_for( $_ ) ]} ]" } + values %env2optdep +) unless scalar grep + { DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for( $_ ) } + values %env2optdep +; - my $dep_group = lc "rdbms_$_"; - if (!DBIx::Class::Optional::Dependencies->req_ok_for($dep_group)) { - diag 'You need to install ' . DBIx::Class::Optional::Dependencies->req_missing_for($dep_group) - . " to test with $_"; +my %dsns; +for my $type (keys %env2optdep) { + my %conninfo; + @conninfo{qw(dsn user password)} = map { $ENV{"DBICTEST_${type}_$_"} } qw(DSN USER PASS); + next unless $conninfo{dsn}; + + my $dep_group = $env2optdep{$type}; + if (!DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for($dep_group)) { + diag "Testing with DBICTEST_${type}_DSN needs " . DBIx::Class::Schema::Loader::Optional::Dependencies->req_missing_for($dep_group); next; } - $dsns{$_}{dsn} = $ENV{"DBICTEST_${_}_DSN"}; - $dsns{$_}{user} = $ENV{"DBICTEST_${_}_USER"}; - $dsns{$_}{password} = $ENV{"DBICTEST_${_}_PASS"}; -}; - -plan skip_all => 'You need to set the DBICTEST_SQLANYWHERE_DSN, _USER and _PASS and/or the DBICTEST_SQLANYWHERE_ODBC_DSN, _USER and _PASS environment variables' - unless %dsns; + $dsns{$type} = \%conninfo; +} my ($schema, $schemas_created); # for cleanup in END for extra tests