my $self = {
config_dir => $config_dir,
_inherited_attributes => [qw/datetime_relative might_have rules/],
- debug => $params->{debug},
+ debug => $params->{debug} || 0,
ignore_sql_errors => $params->{ignore_sql_errors}
};
$self->dump_object(@$entry);
}
- foreach my $dir ($output_dir->children) {
- next if ($dir eq $tmp_output_dir);
- $dir->remove || $dir->rmtree;
+ # clear existing output dir
+ foreach my $child ($output_dir->children) {
+ if ($child->is_dir) {
+ next if ($child eq $tmp_output_dir);
+ if (grep { $_ =~ /\.fix/ } $child->children) {
+ $child->rmtree;
+ }
+ } elsif ($child =~ /_dumper_version$/) {
+ $child->remove;
+ }
}
$self->msg("- moving temp dir to $output_dir");
--- /dev/null
+#!perl
+
+use DBIx::Class::Fixtures;
+use Test::More tests => 4;
+use lib qw(t/lib);
+use DBICTest;
+use Path::Class;
+use Data::Dumper;
+
+# set up and populate schema
+ok(my $schema = DBICTest->init_schema(), 'got schema');
+
+my $config_dir = 't/var/configs';
+
+# do dump
+ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir }), 'object created with correct config dir');
+
+my $output_dir = dir('t/var/fixtures');
+$output_dir->mkpath;
+my $file = file($output_dir, 'test_file');
+my $fh = $file->open('w');
+print $fh 'test file';
+$fh->close;
+
+ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay');
+
+ok(-e $file, 'file still exists');