8 my $dump_path = './t/_dump';
11 package DBICTest::Schema::1;
12 use base qw/ DBIx::Class::Schema::Loader /;
13 __PACKAGE__->loader_options(
15 dump_directory => $dump_path,
20 package DBICTest::Schema::2;
21 use base qw/ DBIx::Class::Schema::Loader /;
22 __PACKAGE__->loader_options(
24 dump_directory => $dump_path,
31 rmtree($dump_path, 1, 0711);
33 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
34 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
36 DBICTest::Schema::1->loader(undef);
37 warnings_like { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
39 qr|Dumping manual schema|,
40 (qr|DBICTest/Schema/1.*?.pm exists, will not overwrite|) x 3,
41 qr|Schema dump completed|
43 'warn and skip when attempting to overwrite without option';
45 rmtree($dump_path, 1, 0711);
47 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
48 ok(!$@, 'no death with dump_directory set (overwrite1)')
49 or diag "Dump failed: $@";
51 DBICTest::Schema::2->loader(undef);
52 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
53 ok(!$@, 'no death with dump_directory set (overwrite2)')
54 or diag "Dump failed: $@";
56 END { rmtree($dump_path, 1, 1); }