Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hashref (not hash) for connection info options #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/dbicdump
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if (@ARGV == 1) {
make_schema_at(
$c->{schema_class},
$c->{loader_options} || {},
[ $dsn, $user, $pass, %{$options} ],
[ $dsn, $user, $pass, $options ],
);
}
else {
Expand Down
65 changes: 65 additions & 0 deletions t/61dbicdump_config_options.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
use DBIx::Class::Schema::Loader::Optional::Dependencies
-skip_all_without => 'test_dbicdump_config';

use strict;
use warnings;

use Test::More;
use File::Path qw/make_path rmtree/;
use DBIx::Class::Schema::Loader::Utils 'slurp_file';
use Try::Tiny;
use namespace::clean;
use lib 't/lib';
use make_dbictest_db ();
use dbixcsl_test_dir '$tdir';

plan tests => 2;

my $config_dir = "$tdir/dbicdump_config";
make_path $config_dir;
my $config_file = "$config_dir/my.conf";

my $dump_path = "$tdir/dbicdump_config_dump";

open my $fh, '>', $config_file
or die "Could not write to $config_file: $!";

print $fh <<"EOF";
schema_class DBICTest::Schema

lib t/lib

<connect_info>
dsn $make_dbictest_db::dsn
<options>
LongReadLen 100000000
LongTrunkOk 1
</options>
</connect_info>

<loader_options>
dump_directory $dump_path
components InflateColumn::DateTime
schema_base_class TestSchemaBaseClass
quiet 1
</loader_options>
EOF

close $fh;

system $^X, 'script/dbicdump', $config_file;

is $? >> 8, 0,
'dbicdump executed successfully';

my $foo = try { slurp_file "$dump_path/DBICTest/Schema/Result/Foo.pm" } || '';

like $foo, qr/InflateColumn::DateTime/,
'loader options read correctly from config_file';

done_testing;

END {
rmtree($config_dir, 1, 1);
rmtree($dump_path, 1, 1);
}