From: Arthur Axel 'fREW' Schmidt Date: Thu, 25 Feb 2010 04:52:02 +0000 (-0600) Subject: less bogus output from tests X-Git-Tag: v0.001000_01~125 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2eaf903b4450604819a24ee038ff2fc3a3302fed;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git less bogus output from tests --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index b1c96de..b325716 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -91,7 +91,9 @@ method deploy { my $deploy = sub { my $line = shift; - return if(!$line || $line =~ /^--|^BEGIN TRANSACTION|^COMMIT|^\s+$/); + # the \nCOMMIT below is entirely to make the tests quieter, + # there is surely a better way to fix it (/m breaks everything) + return if(!$line || $line =~ /^(--|BEGIN TRANSACTION|\nCOMMIT|\s+$)/); $storage->_query_start($line); try { # do a dbh_do cycle here, as we need some error checking in @@ -180,4 +182,4 @@ __PACKAGE__->meta->make_immutable; __END__ -vim: ts=2,sw=2,expandtab +vim: ts=2 sw=2 expandtab diff --git a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm index 2f5ddab..1ba0e72 100644 --- a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm @@ -10,6 +10,12 @@ has storage => ( lazy_build => 1, ); +method _build_storage { + my $s = $self->schema->storage; + $s->_determine_driver; + $s +} + has backup_directory => ( isa => 'Str', is => 'ro', @@ -385,4 +391,4 @@ __PACKAGE__->meta->make_immutable; __END__ -vim: ts=2,sw=2,expandtab +vim: ts=2 sw=2 expandtab diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm index 85b85f8..79b97fb 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -25,7 +25,6 @@ sub _build_deploy_method { databases => $self->databases, upgrade_directory => $self->upgrade_directory, sqltargs => $self->sqltargs, - storage => $self->storage, do_backup => $self->do_backup, }; $args->{backup_directory} = $self->backup_directory diff --git a/t/02-instantiation.t b/t/02-instantiation.t index 4efc955..8536937 100644 --- a/t/02-instantiation.t +++ b/t/02-instantiation.t @@ -7,6 +7,7 @@ use lib 't/lib'; use DBICTest; use DBIx::Class::DeploymentHandler; my $db = 'dbi:SQLite:db.db'; +my @connection = ($db, '', '', { ignore_version => 1 }); my $sql_dir = 't/sql'; unlink 'db.db' if -e 'db.db'; @@ -18,12 +19,13 @@ if (-d 't/sql') { VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 1.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, schema => $s, databases => 'SQLite', + sqltargs => { add_drop_table => 0 }, }); ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly'); @@ -47,7 +49,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 2.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, @@ -86,7 +88,7 @@ VERSION2: { VERSION3: { use_ok 'DBICVersion_v3'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 3.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, @@ -123,4 +125,4 @@ VERSION3: { done_testing; __END__ -vim: ts=2,sw=2,expandtab +vim: ts=2 sw=2 expandtab