7 my $dump_path = './t/_dump';
9 local $SIG{__WARN__} = sub {
10 warn $_[0] unless $_[0] =~
11 /really_erase_my_files|Dumping manual schema|Schema dump completed/;
15 package DBICTest::Schema::1;
16 use base qw/ DBIx::Class::Schema::Loader /;
17 __PACKAGE__->loader_options(
18 dump_directory => $dump_path,
23 package DBICTest::Schema::2;
24 use base qw/ DBIx::Class::Schema::Loader /;
25 __PACKAGE__->loader_options(
26 dump_directory => $dump_path,
27 really_erase_my_files => 1,
33 rmtree($dump_path, 1, 1);
35 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
36 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
38 DBICTest::Schema::1->_loader_invoked(undef);
41 my @warnings_regexes = (
42 qr|Dumping manual schema|,
43 qr|Schema dump completed|,
46 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
47 if ($^O eq 'MSWin32');
51 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
52 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
55 like(shift @warn_output, $_) foreach (@warnings_regexes);
57 rmtree($dump_path, 1, 1);
60 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
61 ok(!$@, 'no death with dump_directory set (overwrite1)')
62 or diag "Dump failed: $@";
64 DBICTest::Schema::2->_loader_invoked(undef);
65 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
66 ok(!$@, 'no death with dump_directory set (overwrite2)')
67 or diag "Dump failed: $@";
69 END { rmtree($dump_path, 1, 1); }