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, qw| DBICTest Schema Overwrite_modifications Foo.pm |);
17 # check that we dumped
18 ok( -f $foopm, 'looks like it dumped' );
20 # now modify one of the files
22 open my $in, '<', $foopm or die "$! reading $foopm";
23 my ($tfh,$temp) = tempfile( UNLINK => 1);
25 s/"bars"/"somethingelse"/;
29 copy( $temp, $foopm );
32 # and dump again without overwrites
35 } qr/mismatch/, 'throws error dumping without overwrite_modifications';
37 # and then dump with overwrite
39 dump_schema( overwrite_modifications => 1 );
40 } 'does not throw when dumping with overwrite_modifications';
44 # need to poke _loader_invoked in order to be able to rerun the
45 # loader multiple times.
46 DBICTest::Schema::Overwrite_modifications->_loader_invoked(0)
47 if @DBICTest::Schema::Overwrite_modifications::ISA;
49 local $SIG{__WARN__} = sub {
51 unless $_[0] =~ /^Dumping manual schema|^Schema dump completed/;
53 DBIx::Class::Schema::Loader::make_schema_at( 'DBICTest::Schema::Overwrite_modifications',
54 { dump_directory => $tempdir,
57 [ $make_dbictest_db::dsn ],