X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2Fdb_colinfo.t;h=41c95a61bd4245af8072a6384ed759e7ea2d54c2;hb=dd369c8a18080c4f27237f23b5842d53da05f570;hp=2b341eb699c1a6e279ce2c25b2c253c8da47c390;hpb=07f3f8fcee38924da9aa2b78864a61843a4fd84b;p=maypole.git diff --git a/t/db_colinfo.t b/t/db_colinfo.t index 2b341eb..41c95a6 100755 --- a/t/db_colinfo.t +++ b/t/db_colinfo.t @@ -1,9 +1,17 @@ #!/usr/bin/perl -w use Test::More; use Data::Dumper; -use lib 'ex'; # Where BeerDB should live +use DBI; +use lib 'examples'; # Where BeerDB should live BEGIN { - plan tests => 65; + my $drh = eval { + DBI->install_driver("mysql"); + my @databases = DBI->data_sources("mysql"); + die "couldn't connect to mysql" unless (@databases); + }; + warn "error : $@ \n" if ($@); + my $testcount = ($@) ? 45 : 65 ; + plan tests => $testcount; } $db = 'test'; @@ -130,10 +138,10 @@ SKIP: { } foreach my $colname (keys %correct_nullables) { - ok( $DB_Class->column_required($colname) == !$correct_nullables{$colname}, "nullable column $colname is required (via column_required)" ) + ok( $DB_Class->column_required($colname) == !$correct_nullables{$colname}, "nullable column $colname is required (via column_required)" ) } - ok($DB_Class->required_columns([qw/score/]), 'set required column(s)'); + ok($DB_Class->required_columns([qw/style name tasted score/]), 'set required column(s)'); foreach my $colname ( @{$DB_Class->required_columns()} ) { ok($correct_nullables{$colname} == 0 || $colname eq 'score',"nullable or required column $colname is required (via required_columns)" );