X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F22dump.t;h=7ead7a786ad56cdea464b0b5c0373a9f3490c059;hb=f8c2ca5eac1d4782c1d5be369c9bd0dcf680cb9d;hp=cc92d9d9168f47796635b714cfee697a473a204c;hpb=c38ec663ec7b40c65613e5ec26542672b15cdbde;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/22dump.t b/t/22dump.t index cc92d9d..7ead7a7 100644 --- a/t/22dump.t +++ b/t/22dump.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use Test::Exception; use Test::Warn; @@ -27,8 +28,6 @@ my $dump_path = "$tdir/dump"; ); } -plan tests => 7; - rmtree($dump_path, 1, 1); lives_ok { @@ -36,6 +35,12 @@ lives_ok { [ qr|^Dumping manual schema|, qr|^Schema dump completed| ]; } 'no death with dump_directory set' or diag "Dump failed: $@"; +is_deeply( + [ sort @{ DBICTest::Schema::1->loader->generated_classes } ], + [ sort 'DBICTest::Schema::1', map "DBICTest::Schema::1::Result::$_", qw(Foo Bar) ], + 'generated_classes has schema and result classes' +); + DBICTest::Schema::1->_loader_invoked(undef); SKIP: { @@ -45,6 +50,12 @@ SKIP: { warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) } [ qr|^Dumping manual schema|, qr|^Schema dump completed| ]; + is_deeply( + [ sort @{ DBICTest::Schema::1->loader->generated_classes } ], + [ ], + 'no classes generated on second dump' + ); + rmtree($dump_path, 1, 1); } @@ -53,6 +64,12 @@ lives_ok { [ qr|^Dumping manual schema|, qr|^Schema dump completed| ]; } 'no death with dump_directory set (overwrite1)' or diag "Dump failed: $@"; +is_deeply( + [ sort @{ DBICTest::Schema::2->loader->generated_classes } ], + [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ], + 'generated_classes has schema and result classes' +); + DBICTest::Schema::2->_loader_invoked(undef); lives_ok { @@ -66,4 +83,12 @@ lives_ok { ]; } 'no death with dump_directory set (overwrite2)' or diag "Dump failed: $@"; +is_deeply( + [ sort @{ DBICTest::Schema::2->loader->generated_classes } ], + [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ], + 'all classes regenerated with really_erase_my_files', +); + +done_testing(); + END { rmtree($dump_path, 1, 1); }