From: Brandon Black Date: Tue, 3 Apr 2007 01:12:24 +0000 (+0000) Subject: some little cleanups, svn meta stuff, and the beginnings a new test file for the... X-Git-Tag: 0.03999_01~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=605fcea8ba8b59e384cc32f38dc5a9e2131fe22b;p=dbsrgits%2FDBIx-Class-Schema-Loader.git some little cleanups, svn meta stuff, and the beginnings a new test file for the new dump code --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 6664d70..21ebd51 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -568,7 +568,7 @@ sub _make_src_class { $self->_use ($table_class, @{$self->additional_classes}); $self->_inject($table_class, @{$self->additional_base_classes}); - $self->_dbic_stmt($table_class, 'load_components', @{$self->components}, qw/PK::Auto Core/); + $self->_dbic_stmt($table_class, 'load_components', @{$self->components}, 'Core'); $self->_dbic_stmt($table_class, 'load_resultset_components', @{$self->resultset_components}) if @{$self->resultset_components}; diff --git a/t/20invocations.t b/t/20invocations.t index fdab791..0603039 100644 --- a/t/20invocations.t +++ b/t/20invocations.t @@ -37,7 +37,7 @@ my @invocations = ( use DBIx::Class::Schema::Loader qw/ make_schema_at /; make_schema_at( 'DBICTest::Schema::7', - { relationships => 1 }, + { dump_overwrite => 1 }, [ $make_dbictest_db::dsn ], ); DBICTest::Schema::7->clone; @@ -47,7 +47,7 @@ my @invocations = ( use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->connect( $make_dbictest_db::dsn, - { loader_options => { relationships => 1 } } + { loader_options => { dump_overwrite => 1 } } ); }, 'embedded_options_in_attrs' => sub { @@ -57,7 +57,7 @@ my @invocations = ( $make_dbictest_db::dsn, undef, undef, - { AutoCommit => 1, loader_options => { relationships => 1 } } + { AutoCommit => 1, loader_options => { dump_overwrite => 1 } } ); }, 'embedded_options_make_schema_at' => sub { @@ -67,7 +67,7 @@ my @invocations = ( { }, [ $make_dbictest_db::dsn, - { loader_options => { relationships => 1 } }, + { loader_options => { dump_overwrite => 1 } }, ], ); "DBICTest::Schema::10"; @@ -75,7 +75,7 @@ my @invocations = ( 'almost_embedded' => sub { package DBICTest::Schema::11; use base qw/ DBIx::Class::Schema::Loader /; - __PACKAGE__->loader_options( relationships => 1 ); + __PACKAGE__->loader_options( dump_overwrite => 1 ); __PACKAGE__->connect( $make_dbictest_db::dsn, undef, undef, { AutoCommit => 1 } @@ -85,7 +85,7 @@ my @invocations = ( use DBIx::Class::Schema::Loader; DBIx::Class::Schema::Loader::make_schema_at( 'DBICTest::Schema::12', - { relationships => 1 }, + { dump_overwrite => 1 }, [ $make_dbictest_db::dsn ], ); DBICTest::Schema::12->clone; diff --git a/t/21misc_fatal.t b/t/21misc_fatal.t index e1627e0..1b78265 100644 --- a/t/21misc_fatal.t +++ b/t/21misc_fatal.t @@ -12,7 +12,7 @@ use make_dbictest_db; package DBICTest::Schema; use base qw/ DBIx::Class::Schema::Loader /; - __PACKAGE__->loader_options( relationships => 1 ); + __PACKAGE__->loader_options( dump_overwrite => 1 ); __PACKAGE__->storage_type( '::xyzzy' ); } diff --git a/t/22dump.t b/t/22dump.t index 78e617b..b67ac74 100644 --- a/t/22dump.t +++ b/t/22dump.t @@ -10,7 +10,6 @@ my $dump_path = './t/_dump'; package DBICTest::Schema::1; use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->loader_options( - relationships => 1, dump_directory => $dump_path, ); } @@ -19,7 +18,6 @@ my $dump_path = './t/_dump'; package DBICTest::Schema::2; use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->loader_options( - relationships => 1, dump_directory => $dump_path, dump_overwrite => 1, ); diff --git a/t/23dumpmore.t b/t/23dumpmore.t new file mode 100644 index 0000000..d41fb66 --- /dev/null +++ b/t/23dumpmore.t @@ -0,0 +1,48 @@ +use strict; +use Test::More; +use lib qw(t/lib); +use File::Path; +use make_dbictest_db; +require DBIx::Class::Schema::Loader; + +plan tests => 5; + +plan skip_all => "ActiveState perl produces additional warnings" + if ($^O eq 'MSWin32'); + +my $dump_path = './t/_dump'; + +sub do_dump_test { + my ($schema_class, $opts) = @_; + + rmtree($dump_path, 1, 1); + + no strict 'refs'; + @{$schema_class . '::ISA'} = ('DBIx::Class::Schema::Loader'); + $schema_class->loader_options(dump_directory => $dump_path, %$opts); + + my @warn_output; + eval { + local $SIG{__WARN__} = sub { push(@warn_output, @_) }; + $schema_class->connect($make_dbictest_db::dsn); + }; + my $err = $@; + $schema_class->storage->disconnect if !$err && $schema_class->storage; + undef *{$schema_class}; + return ($err, \@warn_output); +} + + +{ + my ($err, $warn) = do_dump_test('DBICTest::Schema::1', { }); + ok(!$err); + is(@$warn, 2); + like($warn->[0], qr/Dumping manual schema for DBICTest::Schema::1 to directory /); + like($warn->[1], qr/Schema dump completed/); +} + +ok(1); + +# XXX obviously this test file needs to be fleshed out more :) + +# END { rmtree($dump_path, 1, 1); }