X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi-t%2F01-columns.t;h=4166226d8ecb41fd88368b286009798bf1fb17ae;hb=9c0df5f32b68e23c670c89ce6cdbff60b4bd0ed0;hp=09cae0778a028219dd0992d7308faed4e3b5c69e;hpb=8452e496adea0c57b81f413e11b2f5b5b6e62c5c;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi-t/01-columns.t b/t/cdbi-t/01-columns.t index 09cae07..4166226 100644 --- a/t/cdbi-t/01-columns.t +++ b/t/cdbi-t/01-columns.t @@ -1,6 +1,12 @@ use strict; -use Test::More tests => 24; +use Test::More; + +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") : (tests=> 24); +} + #----------------------------------------------------------------------- # Make sure that we can set up columns properly @@ -16,13 +22,13 @@ State->columns(Weather => qw/Rain Snowfall/); State->columns(Other => qw/Capital Population/); #State->has_many(cities => "City"); -sub accessor_name { +sub accessor_name_for { my ($class, $column) = @_; my $return = $column eq "Rain" ? "Rainfall" : $column; return $return; } -sub mutator_name { +sub mutator_name_for { my ($class, $column) = @_; my $return = $column eq "Rain" ? "set_Rainfall" : "set_$column"; return $return; @@ -37,8 +43,16 @@ use base 'DBIx::Class::Test::SQLite'; City->table('City'); City->columns(All => qw/Name State Population/); -City->has_a(State => 'State'); +{ + # Disable the `no such table' warning + local $SIG{__WARN__} = sub { + my $warning = shift; + warn $warning unless ($warning =~ /\Qno such table: City(1)\E/); + }; + + City->has_a(State => 'State'); +} #------------------------------------------------------------------------- package CD;