THROWAWAY: Don't load unmodified generated external classes
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 23dumpmore.t
1 use strict;
2 use warnings;
3 use Test::More;
4 use DBIx::Class::Schema::Loader::Utils qw/slurp_file write_file/;
5 use namespace::clean;
6 use File::Temp ();
7 use lib qw(t/lib);
8 use dbixcsl_test_dir '$tdir';
9 use dbixcsl_dumper_tests;
10 my $t = 'dbixcsl_dumper_tests';
11
12 $t->cleanup;
13
14 # test loading external content
15 $t->dump_test(
16     classname => 'DBICTest::Schema::_no_skip_load_external',
17     regexes => {
18         Foo => [
19             qr/package DBICTest::Schema::_no_skip_load_external::Foo;.*\nour \$skip_me = "bad mojo";\n1;/s
20         ],
21     },
22 );
23
24 # test skipping external content
25 $t->dump_test(
26     classname => 'DBICTest::Schema::_skip_load_external',
27     options => {
28         skip_load_external => 1,
29     },
30     neg_regexes => {
31         Foo => [
32             qr/package DBICTest::Schema::_skip_load_external::Foo;.*\nour \$skip_me = "bad mojo";\n1;/s
33         ],
34     },
35 );
36
37 $t->cleanup;
38 # test config_file
39 {
40     my $config_file = File::Temp->new (UNLINK => 1);
41
42     print $config_file "{ skip_relationships => 1 }\n";
43     close $config_file;
44
45     $t->dump_test(
46         classname => 'DBICTest::Schema::_config_file',
47         options => { config_file => "$config_file" },
48         neg_regexes => {
49             Foo => [
50                 qr/has_many/,
51             ],
52         },
53     );
54 }
55
56 # proper exception
57 $t->dump_test(
58     classname => 'DBICTest::Schema::_clashing_monikers',
59     test_db_class => 'make_dbictest_db_clashing_monikers',
60     error => qr/tables (?:"bar", "bars"|"bars", "bar") reduced to the same source moniker 'Bar'/,
61 );
62
63
64 $t->cleanup;
65
66 # test naming => { column_accessors => 'preserve' }
67 # also test POD for unique constraint
68 $t->dump_test(
69     classname => 'DBICTest::Schema::_preserve_column_accessors',
70     test_db_class => 'make_dbictest_db_with_unique',
71     options => { naming => { column_accessors => 'preserve' } },
72     neg_regexes => {
73         RouteChange => [
74             qr/\baccessor\b/,
75         ],
76     },
77     regexes => {
78         Baz => [
79             qr/\n\n=head1 UNIQUE CONSTRAINTS\n\n=head2 C<baz_num_unique>\n\n=over 4\n\n=item \* L<\/baz_num>\n\n=back\n\n=cut\n\n__PACKAGE__->add_unique_constraint\("baz_num_unique"\, \["baz_num"\]\);\n\n/,
80         ],
81     }
82 );
83
84 $t->cleanup;
85
86 # test that rels are sorted
87 $t->dump_test(
88     classname => 'DBICTest::Schema::_sorted_rels',
89     test_db_class => 'make_dbictest_db_with_unique',
90     regexes => {
91         Baz => [
92             qr/->might_have\(\n  "quux".*->belongs_to\(\n  "station_visited"/s,
93         ],
94     }
95 );
96
97 $t->cleanup;
98
99 $t->dump_test(
100     classname => 'DBICTest::Schema::_sorted_uniqs',
101     test_db_class => 'make_dbictest_db_multi_unique',
102     regexes => {
103         Bar => [
104             qr/->add_unique_constraint\("uniq1_unique".*->add_unique_constraint\("uniq2_unique"/s,
105         ],
106     },
107 );
108
109 $t->cleanup;
110
111 # test naming => { monikers => 'plural' }
112 $t->dump_test(
113     classname => 'DBICTest::Schema::_plural_monikers',
114     options => { naming => { monikers => 'plural' } },
115     regexes => {
116         Foos => [
117             qr/\n=head1 NAME\n\nDBICTest::Schema::_plural_monikers::Foos\n\n=cut\n\n/,
118         ],
119         Bars => [
120             qr/\n=head1 NAME\n\nDBICTest::Schema::_plural_monikers::Bars\n\n=cut\n\n/,
121         ],
122     },
123 );
124
125 $t->cleanup;
126
127 # test naming => { monikers => 'singular' }
128 $t->dump_test(
129     classname => 'DBICTest::Schema::_singular_monikers',
130     test_db_class => 'make_dbictest_db_plural_tables',
131     options => { naming => { monikers => 'singular' } },
132     regexes => {
133         Foo => [
134             qr/\n=head1 NAME\n\nDBICTest::Schema::_singular_monikers::Foo\n\n=cut\n\n/,
135         ],
136         Bar => [
137             qr/\n=head1 NAME\n\nDBICTest::Schema::_singular_monikers::Bar\n\n=cut\n\n/,
138         ],
139     },
140 );
141
142 $t->cleanup;
143
144 # test naming => { monikers => 'preserve' }
145 $t->dump_test(
146     classname => 'DBICTest::Schema::_preserve_monikers',
147     test_db_class => 'make_dbictest_db_plural_tables',
148     options => { naming => { monikers => 'preserve' } },
149     regexes => {
150         Foos => [
151             qr/\n=head1 NAME\n\nDBICTest::Schema::_preserve_monikers::Foos\n\n=cut\n\n/,
152         ],
153         Bars => [
154             qr/\n=head1 NAME\n\nDBICTest::Schema::_preserve_monikers::Bars\n\n=cut\n\n/,
155         ],
156     },
157 );
158
159 $t->cleanup;
160
161 # test out the POD and "use utf8;"
162 $t->dump_test(
163     classname => 'DBICTest::DumpMore::1',
164     options => {
165         custom_column_info => sub {
166             my ($table, $col, $info) = @_;
167             return +{ extra => { is_footext => 1 } } if $col eq 'footext';
168         },
169         result_base_class => 'My::ResultBaseClass',
170         additional_classes => 'TestAdditional',
171         additional_base_classes => 'TestAdditionalBase',
172         left_base_classes => 'TestLeftBase',
173         components => [ 'TestComponent', '+TestComponentFQN' ],
174     },
175     regexes => {
176         schema => [
177             qr/^use utf8;\n/,
178             qr/package DBICTest::DumpMore::1;/,
179             qr/->load_classes/,
180         ],
181         Foo => [
182             qr/^use utf8;\n/,
183             qr/package DBICTest::DumpMore::1::Foo;/,
184             qr/\n=head1 NAME\n\nDBICTest::DumpMore::1::Foo\n\n=cut\n\nuse strict;\nuse warnings;\n\n/,
185             qr/\n=head1 BASE CLASS: L<My::ResultBaseClass>\n\n=cut\n\nuse base 'My::ResultBaseClass';\n\n/,
186             qr/\n=head1 ADDITIONAL CLASSES USED\n\n=over 4\n\n=item \* L<TestAdditional>\n\n=back\n\n=cut\n\n/,
187             qr/\n=head1 ADDITIONAL BASE CLASSES\n\n=over 4\n\n=item \* L<TestAdditionalBase>\n\n=back\n\n=cut\n\n/,
188             qr/\n=head1 LEFT BASE CLASSES\n\n=over 4\n\n=item \* L<TestLeftBase>\n\n=back\n\n=cut\n\n/,
189             qr/\n=head1 COMPONENTS LOADED\n\n=over 4\n\n=item \* L<DBIx::Class::TestComponent>\n\n=item \* L<TestComponentFQN>\n\n=back\n\n=cut\n\n/,
190             qr/\n=head1 TABLE: C<foo>\n\n=cut\n\n__PACKAGE__->table\("foo"\);\n\n/,
191             qr/\n=head1 ACCESSORS\n\n/,
192             qr/\n=head2 fooid\n\n  data_type: 'integer'\n  is_auto_increment: 1\n  is_nullable: 0\n\n/,
193             qr/\n=head2 footext\n\n  data_type: 'text'\n  default_value: 'footext'\n  extra: \{is_footext => 1\}\n  is_nullable: 1\n\n/,
194             qr/\n=head1 PRIMARY KEY\n\n=over 4\n\n=item \* L<\/fooid>\n\n=back\n\n=cut\n\n__PACKAGE__->set_primary_key\("fooid"\);\n/,
195             qr/\n=head1 RELATIONS\n\n/,
196             qr/\n=head2 bars\n\nType: has_many\n\nRelated object: L<DBICTest::DumpMore::1::Bar>\n\n=cut\n\n/,
197             qr/1;\n$/,
198         ],
199         Bar => [
200             qr/^use utf8;\n/,
201             qr/package DBICTest::DumpMore::1::Bar;/,
202             qr/\n=head1 NAME\n\nDBICTest::DumpMore::1::Bar\n\n=cut\n\nuse strict;\nuse warnings;\n\n/,
203             qr/\n=head1 BASE CLASS: L<My::ResultBaseClass>\n\n=cut\n\nuse base 'My::ResultBaseClass';\n\n/,
204             qr/\n=head1 ADDITIONAL CLASSES USED\n\n=over 4\n\n=item \* L<TestAdditional>\n\n=back\n\n=cut\n\n/,
205             qr/\n=head1 ADDITIONAL BASE CLASSES\n\n=over 4\n\n=item \* L<TestAdditionalBase>\n\n=back\n\n=cut\n\n/,
206             qr/\n=head1 LEFT BASE CLASSES\n\n=over 4\n\n=item \* L<TestLeftBase>\n\n=back\n\n=cut\n\n/,
207             qr/\n=head1 COMPONENTS LOADED\n\n=over 4\n\n=item \* L<DBIx::Class::TestComponent>\n\n=item \* L<TestComponentFQN>\n\n=back\n\n=cut\n\n/,
208             qr/\n=head1 TABLE: C<bar>\n\n=cut\n\n__PACKAGE__->table\("bar"\);\n\n/,
209             qr/\n=head1 ACCESSORS\n\n/,
210             qr/\n=head2 barid\n\n  data_type: 'integer'\n  is_auto_increment: 1\n  is_nullable: 0\n\n/,
211             qr/\n=head2 fooref\n\n  data_type: 'integer'\n  is_foreign_key: 1\n  is_nullable: 1\n\n/,
212             qr/\n=head1 PRIMARY KEY\n\n=over 4\n\n=item \* L<\/barid>\n\n=back\n\n=cut\n\n__PACKAGE__->set_primary_key\("barid"\);\n/,
213             qr/\n=head1 RELATIONS\n\n/,
214             qr/\n=head2 fooref\n\nType: belongs_to\n\nRelated object: L<DBICTest::DumpMore::1::Foo>\n\n=cut\n\n/,
215             qr/\n1;\n$/,
216         ],
217     },
218 );
219
220 $t->append_to_class('DBICTest::DumpMore::1::Foo',q{# XXX This is my custom content XXX});
221
222
223 $t->dump_test(
224     classname => 'DBICTest::DumpMore::1',
225     regexes => {
226         schema => [
227             qr/package DBICTest::DumpMore::1;/,
228             qr/->load_classes/,
229         ],
230         Foo => [
231             qr/package DBICTest::DumpMore::1::Foo;/,
232             qr/->set_primary_key/,
233             qr/1;\n# XXX This is my custom content XXX/,
234         ],
235         Bar => [
236             qr/package DBICTest::DumpMore::1::Bar;/,
237             qr/->set_primary_key/,
238             qr/1;\n$/,
239         ],
240     },
241 );
242
243
244 $t->dump_test(
245     classname => 'DBICTest::DumpMore::1',
246     options => {
247         really_erase_my_files => 1
248     },
249     regexes => {
250         schema => [
251             qr/package DBICTest::DumpMore::1;/,
252             qr/->load_classes/,
253         ],
254         Foo => [
255             qr/package DBICTest::DumpMore::1::Foo;/,
256             qr/->set_primary_key/,
257             qr/1;\n$/,
258         ],
259         Bar => [
260             qr/package DBICTest::DumpMore::1::Bar;/,
261             qr/->set_primary_key/,
262             qr/1;\n$/,
263         ],
264     },
265     neg_regexes => {
266         Foo => [
267             qr/# XXX This is my custom content XXX/,
268         ],
269     },
270 );
271
272
273 $t->cleanup;
274
275 # test namespaces
276 $t->dump_test(
277     classname => 'DBICTest::DumpMore::1',
278     options => {
279         use_namespaces => 1,
280         generate_pod => 0
281     },
282     neg_regexes => {
283         'Result/Foo' => [
284             qr/^=/m,
285         ],
286     },
287 );
288
289
290 $t->dump_test(
291     classname => 'DBICTest::DumpMore::1',
292     options => {
293         db_schema => 'foo_schema',
294         qualify_objects => 1,
295         use_namespaces => 1
296     },
297     warnings => [
298         qr/^db_schema is not supported on SQLite/,
299     ],
300     regexes => {
301         'Result/Foo' => [
302             qr/^\Q__PACKAGE__->table("foo_schema.foo");\E/m,
303             # the has_many relname should not have the schema in it!
304             qr/^__PACKAGE__->has_many\(\n  "bars"/m,
305         ],
306     },
307 );
308
309 # test qualify_objects
310 $t->dump_test(
311     classname => 'DBICTest::DumpMore::1',
312     options => {
313         db_schema => [ 'foo_schema', 'bar_schema' ],
314         qualify_objects => 0,
315         use_namespaces => 1,
316     },
317     warnings => [
318         qr/^db_schema is not supported on SQLite/,
319     ],
320     regexes => {
321         'Result/Foo' => [
322             # the table name should not include the db schema
323             qr/^\Q__PACKAGE__->table("foo");\E/m,
324         ],
325         'Result/Bar' => [
326             # the table name should not include the db schema
327             qr/^\Q__PACKAGE__->table("bar");\E/m,
328         ],
329     },
330 );
331
332 # test moniker_parts
333 $t->dump_test(
334     classname => 'DBICTest::DumpMore::1',
335     options => {
336         db_schema => 'my_schema',
337         moniker_parts => ['_schema', 'name'],
338         qualify_objects => 1,
339         use_namespaces => 1,
340     },
341     warnings => [
342         qr/^db_schema is not supported on SQLite/,
343     ],
344     regexes => {
345         'Result/MySchemaFoo' => [
346             qr/^\Q__PACKAGE__->table("my_schema.foo");\E/m,
347             # the has_many relname should not have the schema in it, but the class should
348             qr/^__PACKAGE__->has_many\(\n  "bars",\n  "DBICTest::DumpMore::1::Result::MySchemaBar"/m,
349         ],
350     },
351 );
352
353 # test moniker_part_separator
354 $t->dump_test(
355     classname => 'DBICTest::DumpMore::1',
356     options => {
357         db_schema => 'my_schema',
358         moniker_parts => ['_schema', 'name'],
359         moniker_part_separator => '::',
360         qualify_objects => 1,
361         use_namespaces => 1,
362     },
363     warnings => [
364         qr/^db_schema is not supported on SQLite/,
365     ],
366     regexes => {
367         'Result/MySchema/Foo' => [
368             qr/^package DBICTest::DumpMore::1::Result::MySchema::Foo;/m,
369             qr/^\Q__PACKAGE__->table("my_schema.foo");\E/m,
370             # the has_many relname should not have the schema in it, but the class should
371             qr/^__PACKAGE__->has_many\(\n  "bars",\n  "DBICTest::DumpMore::1::Result::MySchema::Bar"/m,
372         ],
373     },
374 );
375
376 # test moniker_part_separator + moniker_map + recursive constraints
377 $t->dump_test(
378     classname => 'DBICTest::DumpMore::1',
379     options => {
380         db_schema => 'my_schema',
381         moniker_parts => ['_schema', 'name'],
382         moniker_part_separator => '::',
383         qualify_objects => 1,
384         use_namespaces => 1,
385         moniker_map => {
386             my_schema => { foo => "MySchema::Floop" },
387         },
388         constraint => [ [ qr/my_schema/ => qr/foo|bar/ ] ],
389         exclude => [ [ qr/my_schema/ => qr/bar/ ] ],
390     },
391     generated_results => [qw(MySchema::Floop)],
392     warnings => [
393         qr/^db_schema is not supported on SQLite/,
394     ],
395     regexes => {
396         'Result/MySchema/Floop' => [
397             qr/^package DBICTest::DumpMore::1::Result::MySchema::Floop;/m,
398             qr/^\Q__PACKAGE__->table("my_schema.foo");\E/m,
399         ],
400     },
401     neg_regexes => {
402         'Result/MySchema/Floop' => [
403             # the bar table should not be loaded, so no relationship should exist
404             qr/^__PACKAGE__->has_many\(\n  "bars"/m,
405         ],
406     },
407 );
408
409 # test moniker_map + moniker_part_map
410 $t->dump_test(
411     classname => 'DBICTest::DumpMore::1',
412     options => {
413         db_schema => 'my_schema',
414         moniker_parts => ['_schema', 'name'],
415         moniker_part_separator => '::',
416         moniker_part_map => {
417             _schema => {
418                 my_schema => 'OtherSchema',
419             },
420         },
421         moniker_map => {
422             my_schema => {
423                 foo => 'MySchema::Floop',
424             },
425         },
426         qualify_objects => 1,
427         use_namespaces => 1,
428     },
429     warnings => [
430         qr/^db_schema is not supported on SQLite/,
431     ],
432     regexes => {
433         'Result/MySchema/Floop' => [
434             qr/^package DBICTest::DumpMore::1::Result::MySchema::Floop;/m,
435             qr/^\Q__PACKAGE__->table("my_schema.foo");\E/m,
436             # the has_many relname should not have the schema in it, but the class should
437             qr/^__PACKAGE__->has_many\(\n  "bars",\n  "DBICTest::DumpMore::1::Result::OtherSchema::Bar"/m,
438         ],
439         'Result/OtherSchema/Bar' => [
440             qr/^package DBICTest::DumpMore::1::Result::OtherSchema::Bar;/m,
441             qr/^\Q__PACKAGE__->table("my_schema.bar");\E/m,
442             # the has_many relname should not have the schema in it, but the class should
443             qr/^__PACKAGE__->belongs_to\(\n  "fooref",\n  "DBICTest::DumpMore::1::Result::MySchema::Floop"/m,
444         ],
445
446     },
447 );
448
449
450
451 $t->dump_test(
452     classname => 'DBICTest::DumpMore::1',
453     options => {
454         use_namespaces => 1
455     },
456     regexes => {
457         schema => [
458             qr/package DBICTest::DumpMore::1;/,
459             qr/->load_namespaces/,
460         ],
461         'Result/Foo' => [
462             qr/package DBICTest::DumpMore::1::Result::Foo;/,
463             qr/->set_primary_key/,
464             qr/1;\n$/,
465         ],
466         'Result/Bar' => [
467             qr/package DBICTest::DumpMore::1::Result::Bar;/,
468             qr/->set_primary_key/,
469             qr/1;\n$/,
470         ],
471     },
472 );
473
474
475 $t->dump_test(
476     classname => 'DBICTest::DumpMore::1',
477     options => {
478         use_namespaces => 1,
479         result_namespace => 'Res',
480         resultset_namespace => 'RSet',
481         default_resultset_class => 'RSetBase',
482     },
483     regexes => {
484         schema => [
485             qr/package DBICTest::DumpMore::1;/,
486             qr/->load_namespaces/,
487             qr/result_namespace => "Res"/,
488             qr/resultset_namespace => "RSet"/,
489             qr/default_resultset_class => "RSetBase"/,
490         ],
491         'Res/Foo' => [
492             qr/package DBICTest::DumpMore::1::Res::Foo;/,
493             qr/->set_primary_key/,
494             qr/1;\n$/,
495         ],
496         'Res/Bar' => [
497             qr/package DBICTest::DumpMore::1::Res::Bar;/,
498             qr/->set_primary_key/,
499             qr/1;\n$/,
500         ],
501     },
502 );
503
504
505 $t->dump_test(
506     classname => 'DBICTest::DumpMore::1',
507     options => {
508         use_namespaces => 1,
509         result_namespace => '+DBICTest::DumpMore::1::Res',
510         resultset_namespace => 'RSet',
511         default_resultset_class => 'RSetBase',
512         result_base_class => 'My::ResultBaseClass',
513         schema_base_class => 'My::SchemaBaseClass',
514     },
515     regexes => {
516         schema => [
517             qr/package DBICTest::DumpMore::1;/,
518             qr/->load_namespaces/,
519             qr/result_namespace => "\+DBICTest::DumpMore::1::Res"/,
520             qr/resultset_namespace => "RSet"/,
521             qr/default_resultset_class => "RSetBase"/,
522             qr/use base 'My::SchemaBaseClass'/,
523         ],
524         'Res/Foo' => [
525             qr/package DBICTest::DumpMore::1::Res::Foo;/,
526             qr/use base 'My::ResultBaseClass'/,
527             qr/->set_primary_key/,
528             qr/1;\n$/,
529         ],
530         'Res/Bar' => [
531             qr/package DBICTest::DumpMore::1::Res::Bar;/,
532             qr/use base 'My::ResultBaseClass'/,
533             qr/->set_primary_key/,
534             qr/1;\n$/,
535         ],
536     },
537 );
538
539 $t->dump_test(
540     classname => 'DBICTest::DumpMore::1',
541     options => {
542         use_namespaces    => 1,
543         result_base_class => 'My::MissingResultBaseClass',
544     },
545     error => qr/My::MissingResultBaseClass.*is not installed/,
546 );
547
548 # test quote_char in connect_info for dbicdump
549 $t->dump_test(
550     classname => 'DBICTest::DumpMore::1',
551     extra_connect_info => [
552         '',
553         '',
554         { quote_char => '"' },
555     ],
556 );
557
558 # test fix for RT#70507 (end comment and 1; gets lost if left with actual
559 # custom content)
560
561 $t->dump_test(
562     classname => 'DBICTest::DumpMore::Upgrade',
563     options => {
564         use_namespaces => 0,
565     },
566 );
567
568 my $file = $t->class_file('DBICTest::DumpMore::Upgrade::Foo');
569
570 my $code = slurp_file $file;
571
572 $code =~ s/(?=# You can replace)/sub custom_method { 'custom_method works' }\n0;\n\n/;
573
574 write_file $file, $code;
575
576 $t->dump_test(
577     classname => 'DBICTest::DumpMore::Upgrade',
578     options => {
579         use_namespaces => 1,
580     },
581     generated_results => [qw(Foo Bar)],
582     regexes => {
583         'Result/Foo' => [
584             qr/sub custom_method \{ 'custom_method works' \}\n0;\n\n# You can replace.*\n1;\n\z/,
585         ],
586     },
587 );
588
589 # test dry-run mode
590 $t->dump_test(
591     classname => 'DBICTest::DumpMore::DryRun',
592     options => {
593         dry_run => 1,
594     },
595     generated_results => [qw(Foo Bar)],
596 );
597
598 my $schema_file = $t->class_file('DBICTest::DumpMore::DryRun');
599 ok( !-e $schema_file, "dry-run doesn't create file for schema class" );
600 (my $schema_dir = $schema_file) =~ s/\.pm\z//;
601 ok( !-e $schema_dir, "dry-run doesn't create subdirectory for schema namespace" );
602
603 # test omit_version (RT#92300)
604 $t->dump_test(
605     classname => 'DBICTest::DumpMore::omit_version',
606     options => {
607         omit_version => 1,
608     },
609     regexes => {
610         Foo => [
611             qr/^\# Created by DBIx::Class::Schema::Loader @ \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/m,
612         ],
613     },
614 );
615
616 # test omit_timestamp (RT#92300)
617 $t->dump_test(
618     classname => 'DBICTest::DumpMore::omit_timestamp',
619     options => {
620         omit_timestamp => 1,
621     },
622     regexes => {
623         Foo => [
624             qr/^\# Created by DBIx::Class::Schema::Loader v[\d.]+$/m,
625         ],
626     },
627 );
628
629 # test omit_version and omit_timestamp simultaneously (RT#92300)
630 $t->dump_test(
631     classname => 'DBICTest::DumpMore::omit_both',
632     options => {
633         omit_version => 1,
634         omit_timestamp => 1,
635     },
636     # A positive regex here would match the top comment
637     neg_regexes => {
638         Foo => [
639             qr/^\# Created by DBIx::Class::Schema::Loader.+$/m,
640         ],
641     },
642 );
643
644 my $copy = $t->copy_class('DBICTest::DumpMore::1::Foo', 'dump_copy');
645 diag $copy;
646 unshift @INC, "$tdir/dump_copy";
647
648 $t->dump_test(
649     classname => 'DBICTest::DumpMore::1',
650     neg_regexes => {
651         Foo => [
652             qr/^# These lines were loaded from/m,
653         ],
654     },
655 );
656
657 $t->append_to_class('DBICTest::DumpMore::1::Foo', qq{# XXX This is my external custom content\n}, 'dump_copy');
658
659 $t->dump_test(
660     classname => 'DBICTest::DumpMore::1',
661     options => {
662         really_erase_my_files => 1,
663     },
664     regexes => {
665         Foo => [
666             qr/^# XXX This is my external custom content/m,
667         ],
668     },
669     neg_regexes => {
670         Foo => [
671             qr/^# These lines were loaded from.*^# Created by DBIx::Class::Schema::Loader/,
672         ],
673     },
674 );
675
676
677 done_testing;
678 # vim:et sts=4 sw=4 tw=0: