3 use lib qw(t/backcompat/0.04006/lib);
7 plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests'
8 unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT};
11 my $dump_path = './t/_dump';
14 package DBICTest::Schema::1;
15 use base qw/ DBIx::Class::Schema::Loader /;
16 __PACKAGE__->loader_options(
17 dump_directory => $dump_path,
22 package DBICTest::Schema::2;
23 use base qw/ DBIx::Class::Schema::Loader /;
24 __PACKAGE__->loader_options(
25 dump_directory => $dump_path,
26 really_erase_my_files => 1,
32 rmtree($dump_path, 1, 1);
34 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
35 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
37 DBICTest::Schema::1->_loader_invoked(undef);
40 my @warnings_regexes = (
41 qr|Dumping manual schema|,
42 qr|Schema dump completed|,
45 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
46 if ($^O eq 'MSWin32');
50 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
51 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
54 like(shift @warn_output, $_) foreach (@warnings_regexes);
56 rmtree($dump_path, 1, 1);
59 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
60 ok(!$@, 'no death with dump_directory set (overwrite1)')
61 or diag "Dump failed: $@";
63 DBICTest::Schema::2->_loader_invoked(undef);
64 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
65 ok(!$@, 'no death with dump_directory set (overwrite2)')
66 or diag "Dump failed: $@";
68 END { rmtree($dump_path, 1, 1); }