X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F02-Film.t;h=95a460f5e9796ff32a5018e6f5a774303cb30395;hb=27f3e97d85a38736e91d30f2b78195be898316d9;hp=2eb4f0593aa2d47469d8ecdc1a2fa6a0cdd91ede;hpb=68de943862f06cabd397d2e74d12cd9cdc999779;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi/02-Film.t b/t/cdbi/02-Film.t index 2eb4f05..95a460f 100644 --- a/t/cdbi/02-Film.t +++ b/t/cdbi/02-Film.t @@ -1,21 +1,16 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } +use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat'; + use strict; +use warnings; + use Test::More; use Scalar::Util 'refaddr'; use namespace::clean; $| = 1; -BEGIN { - eval "use DBIx::Class::CDBICompat;"; - if ($@) { - plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); - } - plan tests => 98; -} - -INIT { - use lib 't/cdbi/testlib'; - use Film; -} +use lib 't/cdbi/testlib'; +use Film; ok(Film->can('db_Main'), 'set_db()'); is(Film->__driver, "SQLite", "Driver set correctly"); @@ -35,10 +30,10 @@ is(Film->__driver, "SQLite", "Driver set correctly"); eval { my $id = Film->title }; #like $@, qr/class method/, "Can't get title with no object"; ok $@, "Can't get title with no object"; -} +} eval { my $duh = Film->insert; }; -like $@, qr/create needs a hashref/, "needs a hashref"; +like $@, qr/Result object instantiation requires a hashref as argument/, "needs a hashref"; ok +Film->create_test_film; @@ -229,7 +224,7 @@ ok( # Test that a disconnect doesnt harm anything. { - # SQLite is loud on disconnect/reconnect. + # SQLite is loud on disconnect/reconnect. # This is solved in DBIC but not in ContextualFetch local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ @@ -377,9 +372,7 @@ if (0) { ok !$film, "It destroys itself"; } -SKIP: { - skip "Caching has been removed", 5 - if Film->isa("DBIx::Class::CDBICompat::NoObjectIndex"); +{ # my bad taste is your bad taste my $btaste = Film->retrieve('Bad Taste'); @@ -400,7 +393,7 @@ SKIP: { my $btaste4 = Film->retrieve('Bad Taste'); isnt refaddr $btaste2, refaddr $btaste4, "Clearing cache and retrieving again gives new object"; - + $btaste=Film->insert({ Title => 'Bad Taste 2', Director => 'Peter Jackson', @@ -410,5 +403,7 @@ SKIP: { $btaste2 = Film->retrieve('Bad Taste 2'); is refaddr $btaste, refaddr $btaste2, "Creating and retrieving gives ref to same object"; - + } + +done_testing;