X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest.pm;h=5c76153f267bf0633d72b45c9f0921159cb9828c;hb=5b0b10fe7ae786a335ff61dfd83d0a717c56e020;hp=a58c6bc711ad7a360add896d40e101922f7951f7;hpb=54e0bd0660145a1a86bf7cc460336e0ee9c6cbfa;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index a58c6bc..5c76153 100755 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -42,9 +42,8 @@ default, unless the no_deploy or no_populate flags are set. =cut -sub init_schema { +sub _database { my $self = shift; - my %args = @_; my $db_file = "t/var/DBIxClass.db"; unlink($db_file) if -e $db_file; @@ -55,8 +54,28 @@ sub init_schema { my $dbuser = $ENV{"DBICTEST_DBUSER"} || ''; my $dbpass = $ENV{"DBICTEST_DBPASS"} || ''; - my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass); - $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']); + my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 }); + + return @connect_info; +} + +sub init_schema { + my $self = shift; + my %args = @_; + + my $schema; + + if ($args{compose_connection}) { + $schema = DBICTest::Schema->compose_connection( + 'DBICTest', $self->_database + ); + } else { + $schema = DBICTest::Schema->compose_namespace('DBICTest'); + } + if ( !$args{no_connect} ) { + $schema = $schema->connect($self->_database); + $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']); + } if ( !$args{no_deploy} ) { __PACKAGE__->deploy_schema( $schema ); __PACKAGE__->populate_schema( $schema ) if( !$args{no_populate} );