/[Frey]/trunk/t/60-a3c-hreduorg.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/60-a3c-hreduorg.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 142 by dpavlin, Sun Jul 13 16:17:34 2008 UTC revision 143 by dpavlin, Wed Jul 16 14:17:46 2008 UTC
# Line 2  Line 2 
2  use strict;  use strict;
3  use warnings;  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = @ARGV ? 1 : 0;
6    
7  use Test::More tests => 18;  use Test::More tests => 23;
8  use lib 'lib';  use lib 'lib';
9    
10  #use Devel::LeakTrace::Fast;  #use Devel::LeakTrace::Fast;
# Line 12  use Data::Dump qw/dump/; Line 12  use Data::Dump qw/dump/;
12    
13  BEGIN {  BEGIN {
14          use_ok('A3C::HrEduOrg');          use_ok('A3C::HrEduOrg');
15            use_ok('Frey::Pager');
16  }  }
17    
18  ok( my $u = A3C::HrEduOrg->new( id => 1 ), 'new' );  ok( my $u = A3C::HrEduOrg->new( id => 1 ), 'new' );
# Line 19  isa_ok( $u, 'A3C::HrEduOrg' ); Line 20  isa_ok( $u, 'A3C::HrEduOrg' );
20    
21  diag dump( $u ) if $debug;  diag dump( $u ) if $debug;
22    
23  ok( my ($i,$pager) = $u->collection( { per_page => 10, page => 2 } ), 'collection' );  ok( my $pager = Frey::Pager->new(
24            fey_class => ref($u),
25            item_constructor => sub {
26                    Frey::Web::Item->new( fey_class => ref($u), @_ );
27            },
28    ), 'pager' );
29    ok( $pager->pager->current_page( 2 ), 'current_page 2' );
30    ok( $pager->pager->entries_per_page( 10 ), 'entries_per_page 10' );
31    
32    ok( my $i = $u->collection( $pager ), 'collection' );
33  isa_ok( $i, 'Fey::Object::Iterator' );  isa_ok( $i, 'Fey::Object::Iterator' );
34  diag dump( $i ) if $debug;  diag dump( $i ) if $debug;
35    
36  isa_ok( $pager, 'Data::Page' );  ok(my $dp = $pager->pager, 'pager' );
37  cmp_ok( $pager->first, '==', 11 );  isa_ok( $dp, 'Data::Page' );
38  cmp_ok( $pager->last, '==', 20 );  cmp_ok( $dp->first, '==', 11, 'first' );
39    cmp_ok( $dp->last, '==', 20, 'last' );
40    
41  while ( $u = $i->next ) {  while ( $u = $i->next ) {
42          isa_ok( $u, 'A3C::HrEduOrg' );          isa_ok( $u, 'A3C::HrEduOrg' );
43  }  }
44    

Legend:
Removed from v.142  
changed lines
  Added in v.143

  ViewVC Help
Powered by ViewVC 1.1.26