2 use Test::More tests => 3;
9 use File::Temp qw/ tempdir tempfile /;
11 use DBIx::Class::Schema::Loader;
13 my $tempdir = tempdir( CLEANUP => 1 );
14 my $foopm = File::Spec->catfile( $tempdir,
15 qw| DBICTest Schema Overwrite_modifications Result Foo.pm |);
18 # check that we dumped
19 ok( -f $foopm, 'looks like it dumped' );
21 # now modify one of the files
23 open my $in, '<', $foopm or die "$! reading $foopm";
24 my ($tfh,$temp) = tempfile( UNLINK => 1);
26 s/"bars"/"somethingelse"/;
30 copy( $temp, $foopm );
33 # and dump again without overwrites
36 } qr/mismatch/, 'throws error dumping without overwrite_modifications';
38 # and then dump with overwrite
40 dump_schema( overwrite_modifications => 1 );
41 } 'does not throw when dumping with overwrite_modifications';
45 # need to poke _loader_invoked in order to be able to rerun the
46 # loader multiple times.
47 DBICTest::Schema::Overwrite_modifications->_loader_invoked(0)
48 if @DBICTest::Schema::Overwrite_modifications::ISA;
50 local $SIG{__WARN__} = sub {
52 unless $_[0] =~ /^Dumping manual schema|^Schema dump completed/;
54 DBIx::Class::Schema::Loader::make_schema_at( 'DBICTest::Schema::Overwrite_modifications',
55 { dump_directory => $tempdir,
58 [ $make_dbictest_db::dsn ],