X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2Fdb_colinfo.t;h=3b20f8dcd463376f32fc158047e0a184b5bb58d5;hb=0aed36464b4d092c9e32f70916fb38a1bb124ab6;hp=74dea75bee3c7b728d67ec2a01a2d855a3f8ae93;hpb=79aa8d27d124d06bf88b2fc0487ae97563b98936;p=maypole.git diff --git a/t/db_colinfo.t b/t/db_colinfo.t index 74dea75..3b20f8d 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 DBI; use lib 'examples'; # Where BeerDB should live BEGIN { - plan tests => 45; + 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 : 64 ; + 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)" );