3 use lib qw(t/backcompat/0.04006/lib);
6 use dbixcsl_test_dir qw/$tdir/;
8 plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests'
9 unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT};
11 my $dump_path = "$tdir/dump";
13 local $SIG{__WARN__} = sub {
14 warn @_ unless $_[0] =~
15 /^Dumping manual schema|really_erase_my_files|^Schema dump complete/;
19 package DBICTest::Schema::1;
20 use base qw/ DBIx::Class::Schema::Loader /;
21 __PACKAGE__->loader_options(
22 dump_directory => $dump_path,
27 package DBICTest::Schema::2;
28 use base qw/ DBIx::Class::Schema::Loader /;
29 __PACKAGE__->loader_options(
30 dump_directory => $dump_path,
31 really_erase_my_files => 1,
37 rmtree($dump_path, 1, 1);
39 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
40 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
42 DBICTest::Schema::1->_loader_invoked(undef);
45 my @warnings_regexes = (
46 qr|Dumping manual schema|,
47 qr|Schema dump completed|,
50 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
51 if ($^O eq 'MSWin32');
55 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
56 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
59 like(shift @warn_output, $_) foreach (@warnings_regexes);
61 rmtree($dump_path, 1, 1);
64 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
65 ok(!$@, 'no death with dump_directory set (overwrite1)')
66 or diag "Dump failed: $@";
68 DBICTest::Schema::2->_loader_invoked(undef);
69 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
70 ok(!$@, 'no death with dump_directory set (overwrite2)')
71 or diag "Dump failed: $@";
73 END { rmtree($dump_path, 1, 1) if $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; }