Merge 'trunk' into 'current'
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 23dumpmore.t
CommitLineData
605fcea8 1use strict;
2use Test::More;
3use lib qw(t/lib);
4use File::Path;
5use make_dbictest_db;
6require DBIx::Class::Schema::Loader;
7
8plan tests => 5;
9
10plan skip_all => "ActiveState perl produces additional warnings"
11 if ($^O eq 'MSWin32');
12
13my $dump_path = './t/_dump';
14
15sub do_dump_test {
16 my ($schema_class, $opts) = @_;
17
18 rmtree($dump_path, 1, 1);
19
20 no strict 'refs';
21 @{$schema_class . '::ISA'} = ('DBIx::Class::Schema::Loader');
22 $schema_class->loader_options(dump_directory => $dump_path, %$opts);
23
24 my @warn_output;
25 eval {
26 local $SIG{__WARN__} = sub { push(@warn_output, @_) };
27 $schema_class->connect($make_dbictest_db::dsn);
28 };
29 my $err = $@;
30 $schema_class->storage->disconnect if !$err && $schema_class->storage;
31 undef *{$schema_class};
32 return ($err, \@warn_output);
33}
34
35
36{
37 my ($err, $warn) = do_dump_test('DBICTest::Schema::1', { });
38 ok(!$err);
39 is(@$warn, 2);
40 like($warn->[0], qr/Dumping manual schema for DBICTest::Schema::1 to directory /);
41 like($warn->[1], qr/Schema dump completed/);
42}
43
44ok(1);
45
46# XXX obviously this test file needs to be fleshed out more :)
47
48# END { rmtree($dump_path, 1, 1); }