DBIx-Config
view release on metacpan or search on metacpan
t/02_load_credentials.t view on Meta::CPAN
pass => 'MyPass',
},
title => "Get DB info from hashref.",
},
{
put => [ 'SOME_DATABASE' ],
get => {
dsn => 'dbi:SQLite:dbfile=:memory:',
user => 'MyUser',
pass => 'MyPass',
},
title => "Get DB info from array.",
},
{
put => { dsn => 'AWESOME_DB' },
get => {
dsn => 'dbi:mysql:dbname=epsilon',
user => 'Bravo',
pass => 'ShiJulIanDav',
},
title => "Get DB from hashref without user and pass.",
},
{
put => [ 'dbi:mysql:dbname=foo', 'username', 'password' ],
get => {
dsn => 'dbi:mysql:dbname=foo',
user => 'username',
password => 'password',
},
title => "Pass through of normal ->connect as array.",
},
{
put => {
dsn => 'dbi:mysql:dbname=foo',
user => 'username',
password => 'password'
},
get => {
dsn => 'dbi:mysql:dbname=foo',
user => 'username',
password => 'password',
},
title => "Pass through of normal ->connect as hashref.",
},
{
put => [ 'OPTIONS' ],
get => {
dsn => 'dbi:SQLite:dbfile=:memory:',
user => 'Happy',
pass => 'User',
TRACE_LEVEL => 5,
}
}
];
for my $test ( @$tests ) {
my $obj = DBIx::Config->new();
is_deeply(
$obj->default_load_credentials(
$obj->_make_config(
ref $test->{put} eq 'ARRAY' ? @{$test->{put}} : $test->{put})
), $test->{get}, $test->{title} );
}
done_testing;
( run in 1.679 second using v1.01-cache-2.11-cpan-39bf76dae61 )