qr/\n=head1 TABLE: C<foo>\n\n=cut\n\n__PACKAGE__->table\("foo"\);\n\n/,
qr/\n=head1 ACCESSORS\n\n/,
qr/\n=head2 fooid\n\n data_type: 'integer'\n is_auto_increment: 1\n is_nullable: 0\n\n/,
- qr/\n=head2 footext\n\n data_type: 'text'\n default_value: 'footext'\n extra: {is_footext => 1}\n is_nullable: 1\n\n/,
+ qr/\n=head2 footext\n\n data_type: 'text'\n default_value: 'footext'\n extra: \{is_footext => 1\}\n is_nullable: 1\n\n/,
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/,
qr/\n=head1 RELATIONS\n\n/,
qr/\n=head2 bars\n\nType: has_many\n\nRelated object: L<DBICTest::DumpMore::1::Bar>\n\n=cut\n\n/,
constraint => [ [ qr/my_schema/ => qr/foo|bar/ ] ],
exclude => [ [ qr/my_schema/ => qr/bar/ ] ],
},
+ generated_results => [qw(MySchema::Floop)],
warnings => [
qr/^db_schema is not supported on SQLite/,
],
options => {
use_namespaces => 1,
},
+ generated_results => [qw(Foo Bar)],
regexes => {
'Result/Foo' => [
- qr/sub custom_method { 'custom_method works' }\n0;\n\n# You can replace.*\n1;\n\z/,
+ qr/sub custom_method \{ 'custom_method works' \}\n0;\n\n# You can replace.*\n1;\n\z/,
],
},
);
+# test dry-run mode
+$t->dump_test(
+ classname => 'DBICTest::DumpMore::DryRun',
+ options => {
+ dry_run => 1,
+ },
+ generated_results => [qw(Foo Bar)],
+);
+
+my $schema_file = $t->class_file('DBICTest::DumpMore::DryRun');
+ok( !-e $schema_file, "dry-run doesn't create file for schema class" );
+(my $schema_dir = $schema_file) =~ s/\.pm\z//;
+ok( !-e $schema_dir, "dry-run doesn't create subdirectory for schema namespace" );
+
+# test omit_version (RT#92300)
+$t->dump_test(
+ classname => 'DBICTest::DumpMore::omit_version',
+ options => {
+ omit_version => 1,
+ },
+ regexes => {
+ Foo => [
+ qr/^\# Created by DBIx::Class::Schema::Loader @ \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/m,
+ ],
+ },
+);
+
+# test omit_timestamp (RT#92300)
+$t->dump_test(
+ classname => 'DBICTest::DumpMore::omit_timestamp',
+ options => {
+ omit_timestamp => 1,
+ },
+ regexes => {
+ Foo => [
+ qr/^\# Created by DBIx::Class::Schema::Loader v[\d.]+$/m,
+ ],
+ },
+);
+
+# test omit_version and omit_timestamp simultaneously (RT#92300)
+$t->dump_test(
+ classname => 'DBICTest::DumpMore::omit_both',
+ options => {
+ omit_version => 1,
+ omit_timestamp => 1,
+ },
+ # A positive regex here would match the top comment
+ neg_regexes => {
+ Foo => [
+ qr/^\# Created by DBIx::Class::Schema::Loader.+$/m,
+ ],
+ },
+);
+
done_testing;
# vim:et sts=4 sw=4 tw=0: