X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi-t%2F12-filter.t;h=979ad56846e1325369c65b7d7f8ab510a4fe9e6e;hb=7e36a763a7ba0f4feb35371ddd421d9bc9e62ad1;hp=a51d34d674e893230f735472fbaa2c3917d2cda6;hpb=9bc6db133eae500322e0e3670d5509d27d208f9e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi-t/12-filter.t b/t/cdbi-t/12-filter.t index a51d34d..979ad56 100644 --- a/t/cdbi-t/12-filter.t +++ b/t/cdbi-t/12-filter.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 50); + 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 => 50); } use lib 't/testlib'; @@ -93,12 +98,11 @@ is $@, '', "No errors"; # Iterators #---------------------------------------------------------------------- -SKIP: { - skip "Compat layer doesn't have iterator support yet", 33; +my $it_class = 'DBIx::Class::ResultSet'; sub test_normal_iterator { my $it = $film->actors; - isa_ok $it, "Class::DBI::Iterator"; + isa_ok $it, $it_class; is $it->count, 3, " - with 3 elements"; my $i = 0; while (my $film = $it->next) { @@ -112,7 +116,7 @@ test_normal_iterator; { Film->has_many(actor_ids => [ Actor => 'id' ]); my $it = $film->actor_ids; - isa_ok $it, "Class::DBI::Iterator"; + isa_ok $it, $it_class; is $it->count, 3, " - with 3 elements"; my $i = 0; while (my $film_id = $it->next) { @@ -125,6 +129,10 @@ test_normal_iterator; # make sure nothing gets clobbered; test_normal_iterator; +SKIP: { + #skip "dbic iterators don't support slice yet", 12; + + { my @acts = $film->actors->slice(1, 2); is @acts, 2, "Slice gives 2 actor"; @@ -146,7 +154,9 @@ test_normal_iterator; package Class::DBI::My::Iterator; -use base 'Class::DBI::Iterator'; +use vars qw/@ISA/; + +@ISA = ($it_class); sub slice { qw/fred barney/ } @@ -154,6 +164,8 @@ package main; Actor->iterator_class('Class::DBI::My::Iterator'); +delete $film->{related_resultsets}; + { my @acts = $film->actors->slice(1, 2); is @acts, 2, "Slice gives 2 results";