1 |
dpavlin |
167 |
#!/usr/bin/perl |
2 |
|
|
use strict; |
3 |
|
|
use warnings; |
4 |
|
|
|
5 |
|
|
my $debug = @ARGV ? 1 : 0; |
6 |
|
|
|
7 |
|
|
use Test::More tests => 10; |
8 |
|
|
use lib 'lib'; |
9 |
|
|
|
10 |
|
|
use Data::Dump qw/dump/; |
11 |
|
|
|
12 |
|
|
BEGIN { |
13 |
|
|
use_ok('Strix::Anketa'); |
14 |
|
|
use_ok('Frey::Pager'); |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
ok( my $o = Strix::Anketa->new( id => 8 ), 'new' ); # XXX magic: we know 8 exists |
18 |
|
|
isa_ok( $o, 'Strix::Anketa' ); |
19 |
|
|
diag dump( $o ) if $debug; |
20 |
|
|
|
21 |
|
|
ok( my $i = $o->collection(), 'collection without pager' ); |
22 |
|
|
isa_ok( $i, 'Fey::Object::Iterator' ); |
23 |
|
|
diag dump( $i ) if $debug; |
24 |
|
|
|
25 |
|
|
ok( my $r = $o->total_entries, 'total_entries' ); |
26 |
|
|
diag "total_entries: $r"; # if $debug; |
27 |
|
|
|
28 |
|
|
my $max = 3; |
29 |
|
|
|
30 |
|
|
while ( my $row = $i->next ) { |
31 |
|
|
isa_ok( $row, 'Strix::Anketa' ); |
32 |
|
|
diag dump( $row ) if $debug; |
33 |
|
|
ok( my $pitanja = $row->pitanja, 'pitanja' ); |
34 |
|
|
while ( my $p = $pitanja->next ) { |
35 |
|
|
diag dump( $p ); |
36 |
|
|
} |
37 |
|
|
last if --$max == 0; |
38 |
|
|
} |
39 |
|
|
|