X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F14-might_have.t;h=a02f9873ed5626aa019c0a89b963b09129cb389e;hb=8273e845426f0187b4ad6c4a1b42286fa09a648f;hp=b309edca7f22d774f805f42bbe7c6ff78928cd06;hpb=50891152d0b24649bfd67bdba97feec86b11c064;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi/14-might_have.t b/t/cdbi/14-might_have.t index b309edc..a02f987 100644 --- a/t/cdbi/14-might_have.t +++ b/t/cdbi/14-might_have.t @@ -5,10 +5,8 @@ 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 => 22); + plan tests => 22; } use lib 't/cdbi/testlib'; @@ -26,45 +24,45 @@ Film->might_have(info => Blurb => qw/blurb/); Film->create_test_film; { - ok my $bt = Film->retrieve('Bad Taste'), "Get Film"; - isa_ok $bt, "Film"; - is $bt->info, undef, "No blurb yet"; - # bug where we couldn't write a class with a might_have that didn't_have - $bt->rating(16); - eval { $bt->update }; - is $@, '', "No problems updating when don't have"; - is $bt->rating, 16, "Updated OK"; - - is $bt->blurb, undef, "Bad taste has no blurb"; - $bt->blurb("Wibble bar"); - $bt->update; - is $bt->blurb, "Wibble bar", "And we can write the info"; + ok my $bt = Film->retrieve('Bad Taste'), "Get Film"; + isa_ok $bt, "Film"; + is $bt->info, undef, "No blurb yet"; + # bug where we couldn't write a class with a might_have that didn't_have + $bt->rating(16); + eval { $bt->update }; + is $@, '', "No problems updating when don't have"; + is $bt->rating, 16, "Updated OK"; + + is $bt->blurb, undef, "Bad taste has no blurb"; + $bt->blurb("Wibble bar"); + $bt->update; + is $bt->blurb, "Wibble bar", "And we can write the info"; } { - my $bt = Film->retrieve('Bad Taste'); - my $info = $bt->info; - isa_ok $info, 'Blurb'; - - is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way"; - ok $bt->blurb("New blurb"), "We can set the blurb"; - $bt->update; - is $bt->blurb, $info->blurb, "Blurb has been set"; - - $bt->rating(18); - eval { $bt->update }; - is $@, '', "No problems updating when do have"; - is $bt->rating, 18, "Updated OK"; - - # cascade delete? - { - my $blurb = Blurb->retrieve('Bad Taste'); - isa_ok $blurb => "Blurb"; - $bt->delete; - $blurb = Blurb->retrieve('Bad Taste'); - is $blurb, undef, "Blurb has gone"; - } - + my $bt = Film->retrieve('Bad Taste'); + my $info = $bt->info; + isa_ok $info, 'Blurb'; + + is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way"; + ok $bt->blurb("New blurb"), "We can set the blurb"; + $bt->update; + is $bt->blurb, $info->blurb, "Blurb has been set"; + + $bt->rating(18); + eval { $bt->update }; + is $@, '', "No problems updating when do have"; + is $bt->rating, 18, "Updated OK"; + + # cascade delete? + { + my $blurb = Blurb->retrieve('Bad Taste'); + isa_ok $blurb => "Blurb"; + $bt->delete; + $blurb = Blurb->retrieve('Bad Taste'); + is $blurb, undef, "Blurb has gone"; + } + } {