X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F15-accessor.t;h=574292de13f7f78c7c61f731236906182021e6fd;hb=7d5810cd5d389cee98fecaf5d27ac7ed2f27dce4;hp=72f2c54910bc0772163cdcad5e9135cf0987ae7e;hpb=50891152d0b24649bfd67bdba97feec86b11c064;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi/15-accessor.t b/t/cdbi/15-accessor.t index 72f2c54..574292d 100644 --- a/t/cdbi/15-accessor.t +++ b/t/cdbi/15-accessor.t @@ -1,16 +1,6 @@ use strict; use Test::More; -BEGIN { - eval "use DBIx::Class::CDBICompat;"; - if ($@) { - plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); - next; - } - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 75); -} - INIT { #local $SIG{__WARN__} = #sub { like $_[0], qr/clashes with built-in method/, $_[0] }; @@ -25,6 +15,11 @@ INIT { sub Class::DBI::sheep { ok 0; } } +# Install the deprecation warning intercept here for the rest of the 08 dev cycle +local $SIG{__WARN__} = sub { + warn @_ unless (DBIx::Class->VERSION < 0.09 and $_[0] =~ /Query returned more than one row/); +}; + sub Film::mutator_name { my ($class, $col) = @_; return "set_sheep" if lc $col eq "numexplodingsheep"; @@ -78,7 +73,7 @@ eval { my $data = { %$data }; $data->{NumExplodingSheep} = 1; ok my $bt = Film->find_or_create($data), - "find_or_create Modified accessor - find with column name"; + "find_or_create Modified accessor - find with column name"; isa_ok $bt, "Film"; is $bt->sheep, 1, 'sheep bursting violently'; }; @@ -88,7 +83,7 @@ eval { my $data = { %$data }; $data->{sheep} = 1; ok my $bt = Film->find_or_create($data), - "find_or_create Modified accessor - find with accessor"; + "find_or_create Modified accessor - find with accessor"; isa_ok $bt, "Film"; is $bt->sheep, 1, 'sheep bursting violently'; }; @@ -99,7 +94,7 @@ eval { my $data = { %$data }; $data->{NumExplodingSheep} = 3; ok my $bt = Film->find_or_create($data), - "find_or_create Modified accessor - create with column name"; + "find_or_create Modified accessor - create with column name"; isa_ok $bt, "Film"; is $bt->sheep, 3, 'sheep bursting violently'; }; @@ -109,7 +104,7 @@ eval { my $data = { %$data }; $data->{sheep} = 4; ok my $bt = Film->find_or_create($data), - "find_or_create Modified accessor - create with accessor"; + "find_or_create Modified accessor - create with accessor"; isa_ok $bt, "Film"; is $bt->sheep, 4, 'sheep bursting violently'; }; @@ -160,9 +155,6 @@ is $@, '', "No errors"; like $@, qr/film/, "no hasa film"; eval { - local $SIG{__WARN__} = sub { - warn @_ unless $_[0] =~ /Query returned more than one row/; - }; ok my $f = $ac->movie, "hasa movie"; isa_ok $f, "Film"; is $f->id, $bt->id, " - Bad Taste"; @@ -264,5 +256,7 @@ is $@, '', "No errors"; my $abigail = eval { Film->create({ title => "Abigail's Party" }) }; like $@, qr/read only/, "Or create new films"; - $sandl->discard_changes; + $_->discard_changes for ($naked, $sandl); } + +done_testing;