/[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 109 by dpavlin, Sun Jul 13 13:09:56 2008 UTC revision 969 by dpavlin, Fri Jan 9 16:02:33 2009 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 => 15;  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 = $u->collection( { limit => 10, offset => 3 } ), 'collection' );  ok( my $pager = Frey::ORM::Pager->new(
24  isa_ok( $i, 'Fey::Object::Iterator' );          fey_class => ref($u),
25            item_constructor => sub {
26                    Frey::ORM::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' );
34  diag dump( $i ) if $debug;  diag dump( $i ) if $debug;
35    
36    ok(my $dp = $pager->pager, 'pager' );
37    isa_ok( $dp, 'Data::Page' );
38    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.109  
changed lines
  Added in v.969

  ViewVC Help
Powered by ViewVC 1.1.26