Changeset 429 for wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm
- Timestamp:
- 05/11/08 13:58:49 (5 years ago)
- Files:
-
- 1 modified
-
wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm
r427 r429 5 5 use Wiki::Toolkit; 6 6 use Wiki::Toolkit::TestConfig; 7 use DBI; 7 8 8 9 use vars qw( $VERSION @wiki_info ); … … 43 44 44 45 my %datastore_info; 46 47 my %dsn_prefix = ( MySQL => "dbi:mysql:", 48 Pg => "dbi:Pg:dbname=", 49 SQLite => "dbi:SQLite:dbname="); 50 45 51 foreach my $dbtype (qw( MySQL Pg SQLite )) { 46 52 if ( $configured{$dbtype}{dbname} ) { … … 48 54 my $store_class = "Wiki::Toolkit::Store::$dbtype"; 49 55 my $setup_class = "Wiki::Toolkit::Setup::$dbtype"; 56 my $dsn = $dsn_prefix{$dbtype}.$config{dbname}; 57 my $err; 58 if ($err = _test_dsn( $dsn, $config{dbuser}, $config{dbpass}, $config{dbhost})) { 59 warn "connecting to test $dbtype database failed: $err\n"; 60 warn "will skip $dbtype tests\n"; 61 next; 62 } 50 63 $datastore_info{$dbtype} = { 51 64 class => $store_class, … … 258 271 } 259 272 273 sub _test_dsn { 274 my ( $dsn, $dbuser, $dbpass, $dbhost ) = @_; 275 $dsn .= ";host=$dbhost" if $dbhost; 276 my $dbh = eval { 277 DBI->connect($dsn, $dbuser, $dbpass, {RaiseError => 1}); 278 }; 279 return $@; 280 } 281 282 260 283 =back 261 284 … … 271 294 272 295 Copyright (C) 2003-2004 Kake Pugh. All Rights Reserved. 296 Copyright (C) 2008 the Wiki::Toolkit team. All Rights Reserved. 273 297 274 298 This module is free software; you can redistribute it and/or modify it
