8 use dbixcsl_test_dir qw/$tdir/;
10 my $dump_path = "$tdir/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,
30 rmtree($dump_path, 1, 1);
33 warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
34 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
35 } 'no death with dump_directory set' or diag "Dump failed: $@";
38 [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
39 [ sort 'DBICTest::Schema::1', map "DBICTest::Schema::1::Result::$_", qw(Foo Bar) ],
40 'generated_classes has schema and result classes'
43 DBICTest::Schema::1->_loader_invoked(undef);
46 skip "ActiveState perl produces additional warnings", 1
47 if ($^O eq 'MSWin32');
49 warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
50 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
53 [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
55 'no classes generated on second dump'
58 rmtree($dump_path, 1, 1);
62 warnings_exist { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }
63 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
64 } 'no death with dump_directory set (overwrite1)' or diag "Dump failed: $@";
67 [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
68 [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
69 'generated_classes has schema and result classes'
72 DBICTest::Schema::2->_loader_invoked(undef);
75 warnings_exist { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }
77 qr/^Dumping manual schema/,
78 qr|^Deleting .+Schema/2.+ due to 'really_erase_my_files'|,
79 qr|^Deleting .+Schema/2/Result/Foo.+ due to 'really_erase_my_files'|,
80 qr|^Deleting .+Schema/2/Result/Bar.+ due to 'really_erase_my_files'|,
81 qr/^Schema dump completed/
83 } 'no death with dump_directory set (overwrite2)' or diag "Dump failed: $@";
86 [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
87 [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
88 'all classes regenerated with really_erase_my_files',
93 END { rmtree($dump_path, 1, 1); }