this stuff does not work yet
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / backcompat / 0.04006 / 22dump.t
CommitLineData
9a95164d 1use strict;
2use Test::More;
3use lib qw(t/lib);
4use File::Path;
5use make_dbictest_db;
6
7my $dump_path = './t/_dump';
8
9{
10 package DBICTest::Schema::1;
11 use base qw/ DBIx::Class::Schema::Loader /;
12 __PACKAGE__->loader_options(
13 dump_directory => $dump_path,
14 );
15}
16
17{
18 package DBICTest::Schema::2;
19 use base qw/ DBIx::Class::Schema::Loader /;
20 __PACKAGE__->loader_options(
21 dump_directory => $dump_path,
22 really_erase_my_files => 1,
23 );
24}
25
26plan tests => 5;
27
28rmtree($dump_path, 1, 1);
29
30eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
31ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
32
33DBICTest::Schema::1->_loader_invoked(undef);
34
35SKIP: {
36 my @warnings_regexes = (
37 qr|Dumping manual schema|,
38 qr|Schema dump completed|,
39 );
40
41 skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
42 if ($^O eq 'MSWin32');
43
44 my @warn_output;
45 {
46 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
47 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
48 }
49
50 like(shift @warn_output, $_) foreach (@warnings_regexes);
51
52 rmtree($dump_path, 1, 1);
53}
54
55eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
56ok(!$@, 'no death with dump_directory set (overwrite1)')
57 or diag "Dump failed: $@";
58
59DBICTest::Schema::2->_loader_invoked(undef);
60eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
61ok(!$@, 'no death with dump_directory set (overwrite2)')
62 or diag "Dump failed: $@";
63
64END { rmtree($dump_path, 1, 1); }