X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest.pm;h=5c76153f267bf0633d72b45c9f0921159cb9828c;hb=14ad95291d2a5fe439fdb19058f05a685bd0331e;hp=97855cb57612035b6abcaa8009f67ca50630b699;hpb=78060df8cb43cafd81304f386d7111510a4b8f9d;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 97855cb..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} ); @@ -225,8 +244,8 @@ sub populate_schema { ]); $schema->populate('Link', [ - [ qw/id title/ ], - [ 1, 'aaa' ] + [ qw/id url title/ ], + [ 1, '', 'aaa' ] ]); $schema->populate('Bookmark', [