View | Details | Raw Unified | Return to bug 12469
Collapse All | Expand All

(-)a/t/db_dependent/ILSDI_Services.t (-2 / +31 lines)
Lines 18-25 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use XML::LibXML;
21
22
22
use Test::More tests => 9;
23
use Test::More tests => 10;
23
use Test::MockModule;
24
use Test::MockModule;
24
use t::lib::Mocks;
25
use t::lib::Mocks;
25
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
Lines 684-686 subtest 'GetPatronInfo paginated loans' => sub { Link Here
684
685
685
    $schema->storage->txn_rollback;
686
    $schema->storage->txn_rollback;
686
};
687
};
687
- 
688
689
subtest 'GetAvailability tests' => sub {
690
    plan tests => 5;
691
692
    $schema->storage->txn_begin;
693
694
    my $library = $builder->build_object({
695
        class => 'Koha::Libraries',
696
    });
697
698
    my $item1 = $builder->build_sample_item({ library => $library->branchcode,
699
                                              itemcallnumber => "CAL.123",
700
                                            });
701
702
    my $cgi = new CGI;
703
704
    $cgi->param( 'service', 'GetAvailability' );
705
    $cgi->param( 'id', $item1->itemnumber );
706
    $cgi->param( 'id_type', 'item' );
707
    my $reply = XML::LibXML->load_xml( string => C4::ILSDI::Services::GetAvailability($cgi) );
708
709
    is($reply->findnodes('//dlf:identifier'), $item1->itemnumber, 'itemnumber valid');
710
    is($reply->findnodes('//dlf:availabilitystatus'), 'available', 'item1 is available');
711
    is($reply->findnodes('//dlf:location'), $library->branchname, 'item1 location (branchname) is fine');
712
    is($reply->findnodes('//dlf:callnumber'), $item1->itemcallnumber, 'item1 callnumber is returned too');
713
    is($reply->findnodes('//dlf:dateavailable'), DateTime->now , 'item1 available as of now');
714
715
    $schema->storage->txn_rollback;
716
};

Return to bug 12469