- Add forgotten attributes to Admin.pm
* Misc
+ - Add extra option groups to DBIC::Optional::Depencencies, to aid
+ users in requesting the prerequisites for a particular RDBMS
- Switch all serialization to use Storable::nfreeze for portable
architecture independent ice
- Fix the bogus META.yml dependency injection issue for good
test_requires => { %$test_requires },
};
+my %reqs_for_group = %{DBIx::Class::Optional::Dependencies->req_group_list};
+
+# exclude the rdbms_* groups which are for DBIC users
my $opt_testdeps = {
- map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list})
+ map { %{$reqs_for_group{$_}} } grep { !/^rdbms_/ } keys %reqs_for_group
};
# require extra modules for testing if we're in a checkout
'Math::Base36' => '0.07',
};
+my $rdbms_sqlite = {
+ 'DBD::SQLite' => '0',
+};
+my $rdbms_pg = {
+ 'DBD::Pg' => '0',
+};
+my $rdbms_mssql_odbc = {
+ 'DBD::ODBC' => '0',
+};
+my $rdbms_mssql_sybase = {
+ 'DBD::Sybase' => '0',
+};
+my $rdbms_mysql = {
+ 'DBD::mysql' => '0',
+};
+my $rdbms_oracle = {
+ 'DBD::Oracle' => '0',
+ %$id_shortener,
+};
+my $rdbms_ase = {
+ 'DBD::Sybase' => '0',
+};
+my $rdbms_db2 = {
+ 'DBD::DB2' => '0',
+};
+
my $reqs = {
dist => {
#'Module::Install::Pod::Inherit' => '0.01',
},
},
+ # this is just for completeness as SQLite
+ # is a core dep of DBIC for testing
+ rdbms_sqlite => {
+ req => {
+ %$rdbms_sqlite,
+ },
+ pod => {
+ title => 'SQLite support',
+ desc => 'Modules required to connect to SQLite',
+ },
+ },
+
+ rdbms_pg => {
+ req => {
+ %$rdbms_pg,
+ },
+ pod => {
+ title => 'PostgreSQL support',
+ desc => 'Modules required to connect to PostgreSQL',
+ },
+ },
+
+ rdbms_mssql_odbc => {
+ req => {
+ %$rdbms_mssql_odbc,
+ },
+ pod => {
+ title => 'MSSQL support via DBD::ODBC',
+ desc => 'Modules required to connect to MSSQL via DBD::ODBC',
+ },
+ },
+
+ rdbms_mssql_sybase => {
+ req => {
+ %$rdbms_mssql_sybase,
+ },
+ pod => {
+ title => 'MSSQL support via DBD::Sybase',
+ desc => 'Modules required to connect to MSSQL support via DBD::Sybase',
+ },
+ },
+
+ rdbms_mysql => {
+ req => {
+ %$rdbms_mysql,
+ },
+ pod => {
+ title => 'MySQL support',
+ desc => 'Modules required to connect to MySQL',
+ },
+ },
+
+ rdbms_oracle => {
+ req => {
+ %$rdbms_oracle,
+ },
+ pod => {
+ title => 'Oracle support',
+ desc => 'Modules required to connect to Oracle',
+ },
+ },
+
+ rdbms_ase => {
+ req => {
+ %$rdbms_ase,
+ },
+ pod => {
+ title => 'Sybase ASE support',
+ desc => 'Modules required to connect to Sybase ASE',
+ },
+ },
+
+ rdbms_db2 => {
+ req => {
+ %$rdbms_db2,
+ },
+ pod => {
+ title => 'DB2 support',
+ desc => 'Modules required to connect to DB2',
+ },
+ },
+
+# the order does matter because the rdbms support group might require
+# a different version that the test group
test_rdbms_pg => {
req => {
$ENV{DBICTEST_PG_DSN}
? (
+ %$rdbms_pg,
'Sys::SigAction' => '0',
'DBD::Pg' => '2.009002',
) : ()
req => {
$ENV{DBICTEST_MSSQL_ODBC_DSN}
? (
- 'DBD::ODBC' => '0',
+ %$rdbms_mssql_odbc,
) : ()
},
},
req => {
$ENV{DBICTEST_MSSQL_DSN}
? (
- 'DBD::Sybase' => '0',
+ %$rdbms_mssql_sybase,
) : ()
},
},
req => {
$ENV{DBICTEST_MYSQL_DSN}
? (
- 'DBD::mysql' => '0',
+ %$rdbms_mysql,
) : ()
},
},
req => {
$ENV{DBICTEST_ORA_DSN}
? (
- %$id_shortener,
+ %$rdbms_oracle,
'DateTime::Format::Oracle' => '0',
'DBD::Oracle' => '1.24',
) : ()
req => {
$ENV{DBICTEST_SYBASE_DSN}
? (
- 'DateTime::Format::Sybase' => 0,
+ %$rdbms_ase,
+ 'DateTime::Format::Sybase' => '0',
) : ()
},
},
req => {
$ENV{DBICTEST_DB2_DSN}
? (
- 'DBD::DB2' => 0,
+ %$rdbms_db2,
) : ()
},
},
require $class;
- my \$deploy_deps = $class->req_list_for ('deploy');
+ my \$deploy_deps = $class->req_list_for('deploy');
for (keys %\$deploy_deps) {
requires \$_ => \$deploy_deps->{\$_};
no warnings qw/once/;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use Scalar::Util; # load before we break require()
use Carp (); # Carp is not used in the test, but we want to have it loaded for proper %INC comparison
my $inc_before = [ keys %INC ];
ok ( (! grep { $_ =~ m|DBIx/Class| } @$inc_before ), 'Nothing DBIC related is yet loaded');
+# DBIx::Class::Optional::Dependencies queries $ENV at compile time
+# to build the optional requirements
+BEGIN {
+ $ENV{DBICTEST_PG_DSN} = '1';
+ $ENV{DBICTEST_ORA_DSN} = undef;
+}
+
use_ok 'DBIx::Class::Optional::Dependencies';
my $inc_after = [ keys %INC ];
'expected empty errorlist',
);
+# test multiple times to find autovivification bugs
+for (1..2) {
+ throws_ok {
+ DBIx::Class::Optional::Dependencies->req_list_for();
+ } qr/\Qreq_list_for() expects a requirement group name/,
+ "req_list_for without groupname throws exception on run $_";
+
+ throws_ok {
+ DBIx::Class::Optional::Dependencies->req_list_for('');
+ } qr/\Qreq_list_for() expects a requirement group name/,
+ "req_list_for with empty groupname throws exception on run $_";
+
+ throws_ok {
+ DBIx::Class::Optional::Dependencies->req_list_for('invalid_groupname');
+ } qr/Requirement group 'invalid_groupname' does not exist/,
+ "req_list_for with invalid groupname throws exception on run $_";
+}
+
+is_deeply(
+ DBIx::Class::Optional::Dependencies->req_list_for('rdbms_pg'),
+ {
+ 'DBD::Pg' => '0',
+ }, 'optional dependencies for deploying to Postgres ok');
+
+is_deeply(
+ DBIx::Class::Optional::Dependencies->req_list_for('test_rdbms_pg'),
+ {
+ 'Sys::SigAction' => '0',
+ 'DBD::Pg' => '2.009002',
+ }, 'optional dependencies for testing Postgres with ENV var ok');
+
+is_deeply(
+ DBIx::Class::Optional::Dependencies->req_list_for('test_rdbms_oracle'),
+ {}, 'optional dependencies for testing Oracle without ENV var ok');
+
done_testing;