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};
10 my $dump_path = './t/_dump';
13 package DBICTest::Schema::1;
14 use base qw/ DBIx::Class::Schema::Loader /;
15 __PACKAGE__->loader_options(
16 dump_directory => $dump_path,
21 package DBICTest::Schema::2;
22 use base qw/ DBIx::Class::Schema::Loader /;
23 __PACKAGE__->loader_options(
24 dump_directory => $dump_path,
25 really_erase_my_files => 1,
31 rmtree($dump_path, 1, 1);
33 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
34 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
36 DBICTest::Schema::1->_loader_invoked(undef);
39 my @warnings_regexes = (
40 qr|Dumping manual schema|,
41 qr|Schema dump completed|,
44 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
45 if ($^O eq 'MSWin32');
49 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
50 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
53 like(shift @warn_output, $_) foreach (@warnings_regexes);
55 rmtree($dump_path, 1, 1);
58 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
59 ok(!$@, 'no death with dump_directory set (overwrite1)')
60 or diag "Dump failed: $@";
62 DBICTest::Schema::2->_loader_invoked(undef);
63 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
64 ok(!$@, 'no death with dump_directory set (overwrite2)')
65 or diag "Dump failed: $@";
67 END { rmtree($dump_path, 1, 1); }