2 use File::Slurp qw(slurp);
4 use Test::More tests => 4;
8 use dbixcsl_test_dir qw/$tdir/;
10 use DBIx::Class::Schema::Loader;
12 my $dump_path = "$tdir/dump";
14 my %original_class_data;
17 package DBICTest::Schema::1;
18 use base qw/ DBIx::Class::Schema::Loader /;
19 __PACKAGE__->loader_options(
20 dump_directory => $dump_path,
21 filter_generated_text => sub {
22 my ($class, $text) = @_;
23 $original_class_data{$class} = $text;
24 if ($class =~ /::1$/) {
28 $text .= q{"Kilroy was here";};
35 DBICTest::Schema::1->connect($make_dbictest_db::dsn);
37 my $foo = slurp("$dump_path/DBICTest/Schema/1/Result/Foo.pm");
38 ok(! -e "$dump_path/DBICTest/Schema/1.pm",
39 "No package means no file written");
40 ok($original_class_data{"DBICTest::Schema::1"},
41 "Even though we processed the missing class");
42 like($foo, qr/# Created by .* THE FIRST PART/s,
43 "We get the whole autogenerated text");
44 like($foo, qr/Kilroy was here/, "Can insert text");
46 END { rmtree($dump_path, 1, 1); }