1 use DBIx::Class::Schema::Loader::Optional::Dependencies
2 -skip_all_without => 'test_backcompat';
7 use lib qw(t/backcompat/0.04006/lib);
10 use dbixcsl_test_dir qw/$tdir/;
12 my $dump_path = "$tdir/dump";
14 local $SIG{__WARN__} = sub {
15 warn @_ unless $_[0] =~
16 /^Dumping manual schema|really_erase_my_files|^Schema dump complete/;
20 package DBICTest::Schema::1;
21 use base qw/ DBIx::Class::Schema::Loader /;
22 __PACKAGE__->loader_options(
23 dump_directory => $dump_path,
28 package DBICTest::Schema::2;
29 use base qw/ DBIx::Class::Schema::Loader /;
30 __PACKAGE__->loader_options(
31 dump_directory => $dump_path,
32 really_erase_my_files => 1,
38 rmtree($dump_path, 1, 1);
40 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
41 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
43 DBICTest::Schema::1->_loader_invoked(undef);
46 my @warnings_regexes = (
47 qr|Dumping manual schema|,
48 qr|Schema dump completed|,
51 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
52 if ($^O eq 'MSWin32');
56 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
57 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
60 like(shift @warn_output, $_) foreach (@warnings_regexes);
62 rmtree($dump_path, 1, 1);
65 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
66 ok(!$@, 'no death with dump_directory set (overwrite1)')
67 or diag "Dump failed: $@";
69 DBICTest::Schema::2->_loader_invoked(undef);
70 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
71 ok(!$@, 'no death with dump_directory set (overwrite2)')
72 or diag "Dump failed: $@";
74 END { rmtree($dump_path, 1, 1) if $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; }