2 use Test::More tests => 5;
10 use File::Temp qw/ tempdir tempfile /;
12 use DBIx::Class::Schema::Loader;
14 my $tempdir = tempdir( CLEANUP => 1 );
15 my $foopm = File::Spec->catfile( $tempdir,
16 qw| DBICTest Schema Overwrite_modifications Result Foo.pm |);
19 # check that we dumped
20 ok( -f $foopm, 'looks like it dumped' );
22 # now modify one of the files
24 open my $in, '<', $foopm or die "$! reading $foopm";
25 my ($tfh,$temp) = tempfile( UNLINK => 1);
27 s/"bars"/"somethingelse"/;
31 copy( $temp, $foopm );
34 # and dump again without overwrites
37 } qr/mismatch/, 'throws error dumping without overwrite_modifications';
39 # and then dump with overwrite
41 dump_schema( overwrite_modifications => 1 );
42 } 'does not throw when dumping with overwrite_modifications';
46 # need to poke _loader_invoked in order to be able to rerun the
47 # loader multiple times.
48 DBICTest::Schema::Overwrite_modifications->_loader_invoked(0)
49 if @DBICTest::Schema::Overwrite_modifications::ISA;
54 DBIx::Class::Schema::Loader::make_schema_at( 'DBICTest::Schema::Overwrite_modifications',
55 { dump_directory => $tempdir, @$args },
56 [ $make_dbictest_db::dsn ],
58 } [qr/^Dumping manual schema/, qr/^Schema dump completed/ ];