--- trunk/t/60-a3c-hreduorg.t 2008/07/13 16:17:34 111 +++ trunk/t/60-a3c-hreduorg.t 2008/07/16 14:17:46 143 @@ -2,9 +2,9 @@ use strict; use warnings; -my $debug = shift @ARGV; +my $debug = @ARGV ? 1 : 0; -use Test::More tests => 18; +use Test::More tests => 23; use lib 'lib'; #use Devel::LeakTrace::Fast; @@ -12,6 +12,7 @@ BEGIN { use_ok('A3C::HrEduOrg'); + use_ok('Frey::Pager'); } ok( my $u = A3C::HrEduOrg->new( id => 1 ), 'new' ); @@ -19,14 +20,25 @@ diag dump( $u ) if $debug; -ok( my ($i,$pager) = $u->collection( { per_page => 10, page => 2 } ), 'collection' ); +ok( my $pager = Frey::Pager->new( + fey_class => ref($u), + item_constructor => sub { + Frey::Web::Item->new( fey_class => ref($u), @_ ); + }, +), 'pager' ); +ok( $pager->pager->current_page( 2 ), 'current_page 2' ); +ok( $pager->pager->entries_per_page( 10 ), 'entries_per_page 10' ); + +ok( my $i = $u->collection( $pager ), 'collection' ); isa_ok( $i, 'Fey::Object::Iterator' ); diag dump( $i ) if $debug; -isa_ok( $pager, 'Data::Page' ); -cmp_ok( $pager->first, '==', 11 ); -cmp_ok( $pager->last, '==', 20 ); +ok(my $dp = $pager->pager, 'pager' ); +isa_ok( $dp, 'Data::Page' ); +cmp_ok( $dp->first, '==', 11, 'first' ); +cmp_ok( $dp->last, '==', 20, 'last' ); while ( $u = $i->next ) { isa_ok( $u, 'A3C::HrEduOrg' ); } +