X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F2-input-koha.t;h=04409877bd148543ce983d649623ccc61ae13c3e;hb=HEAD;hp=b278f72bfb89b6ac5d890c567128a1a8fd82ef20;hpb=0406ea7ba594c7eb629426633ad3e0568d25df56;p=webpac2 diff --git a/t/2-input-koha.t b/t/2-input-koha.t index b278f72..0440987 100755 --- a/t/2-input-koha.t +++ b/t/2-input-koha.t @@ -3,7 +3,7 @@ use strict; use lib 'lib'; -use Test::More tests => 27; +use Test::More tests => 28; BEGIN { use_ok( 'WebPAC::Test' ); @@ -19,19 +19,20 @@ ok(my $input = new WebPAC::Input( %LOG ), "new"); +my $path = '/tmp/koha.marc'; + ok(my $db = $input->open( - path => '/tmp/koha.marc', # required? + path => $path, dsn => 'dbi:mysql:database=koha', user => $ENV{KOHA_USER}, passwd => $ENV{KOHA_PASSWD}, - sql => q{ - select biblioitemnumber as mfn, marc from biblioitems limit 7 - }, + limit => 7, + offset => 3, ), "open"); ok(my $size = $input->size, "size"); cmp_ok( $size, '==', 7, 'size ok' ); -foreach my $mfn ( 1 ... $size ) { +foreach my $mfn ( 3 + 1 ... 3 + $size ) { my $rec = $input->fetch; ok($rec, "fetch $mfn"); cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn'); @@ -39,3 +40,4 @@ foreach my $mfn ( 1 ... $size ) { diag "rec: ", dump($rec), "\n" if $debug; } +ok( unlink $path, "unlink $path" );