/[webpac2]/trunk/t/2-input-koha.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/2-input-koha.t

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

revision 1324 by dpavlin, Thu Jul 9 17:00:51 2009 UTC revision 1325 by dpavlin, Tue Feb 2 18:03:17 2010 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use lib 'lib';  use lib 'lib';
5    
6  use Test::More tests => 27;  use Test::More tests => 28;
7    
8  BEGIN {  BEGIN {
9  use_ok( 'WebPAC::Test' );  use_ok( 'WebPAC::Test' );
# Line 19  ok(my $input = new WebPAC::Input( Line 19  ok(my $input = new WebPAC::Input(
19          %LOG          %LOG
20  ), "new");  ), "new");
21    
22    my $path = '/tmp/koha.marc';
23    
24  ok(my $db = $input->open(  ok(my $db = $input->open(
25          path => '/tmp/koha.marc', # required?          path   => $path,
26          dsn    => 'dbi:mysql:database=koha',          dsn    => 'dbi:mysql:database=koha',
27          user   => $ENV{KOHA_USER},          user   => $ENV{KOHA_USER},
28          passwd => $ENV{KOHA_PASSWD},          passwd => $ENV{KOHA_PASSWD},
29          sql    => q{          limit  => 7,
30                  select biblioitemnumber as mfn, marc from biblioitems limit 7          offset => 3,
         },  
31  ), "open");  ), "open");
32  ok(my $size = $input->size, "size");  ok(my $size = $input->size, "size");
33  cmp_ok( $size, '==', 7, 'size ok' );  cmp_ok( $size, '==', 7, 'size ok' );
34    
35  foreach my $mfn ( 1 ... $size ) {  foreach my $mfn ( 3 + 1 ... 3 + $size ) {
36          my $rec = $input->fetch;          my $rec = $input->fetch;
37          ok($rec, "fetch $mfn");          ok($rec, "fetch $mfn");
38          cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');          cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');
# Line 39  foreach my $mfn ( 1 ... $size ) { Line 40  foreach my $mfn ( 1 ... $size ) {
40          diag "rec: ", dump($rec), "\n" if $debug;          diag "rec: ", dump($rec), "\n" if $debug;
41  }  }
42    
43    ok( unlink $path, "unlink $path" );

Legend:
Removed from v.1324  
changed lines
  Added in v.1325

  ViewVC Help
Powered by ViewVC 1.1.26