9 use dbixcsl_test_dir qw/$tdir/;
11 my $dump_path = "$tdir/dump";
15 package DBICTest::Schema::1;
16 use base qw/ DBIx::Class::Schema::Loader /;
17 __PACKAGE__->loader_options(
18 dump_directory => $dump_path,
23 package DBICTest::Schema::2;
24 use base qw/ DBIx::Class::Schema::Loader /;
25 __PACKAGE__->loader_options(
26 dump_directory => $dump_path,
27 really_erase_my_files => 1,
31 rmtree($dump_path, 1, 1);
34 warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
35 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
36 } 'no death with dump_directory set' or diag "Dump failed: $@";
39 [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
40 [ sort 'DBICTest::Schema::1', map "DBICTest::Schema::1::Result::$_", qw(Foo Bar) ],
41 'generated_classes has schema and result classes'
44 DBICTest::Schema::1->_loader_invoked(undef);
47 skip "ActiveState perl produces additional warnings", 1
48 if ($^O eq 'MSWin32');
50 warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
51 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
54 [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
56 'no classes generated on second dump'
59 rmtree($dump_path, 1, 1);
63 warnings_exist { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }
64 [ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
65 } 'no death with dump_directory set (overwrite1)' or diag "Dump failed: $@";
68 [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
69 [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
70 'generated_classes has schema and result classes'
73 DBICTest::Schema::2->_loader_invoked(undef);
76 warnings_exist { DBICTest::Schema::2->connect($make_dbictest_db::dsn) }
78 qr/^Dumping manual schema/,
79 qr|^Deleting .+Schema/2.+ due to 'really_erase_my_files'|,
80 qr|^Deleting .+Schema/2/Result/Foo.+ due to 'really_erase_my_files'|,
81 qr|^Deleting .+Schema/2/Result/Bar.+ due to 'really_erase_my_files'|,
82 qr/^Schema dump completed/
84 } 'no death with dump_directory set (overwrite2)' or diag "Dump failed: $@";
87 [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
88 [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
89 'all classes regenerated with really_erase_my_files',
94 END { rmtree($dump_path, 1, 1); }