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

(-)a/t/db_dependent/ILSDI_Services.t (-2 / +46 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
21
22
use Test::NoWarnings;
22
use Test::NoWarnings;
23
use Test::More tests => 15;
23
use Test::More tests => 16;
24
use Test::MockModule;
24
use Test::MockModule;
25
use t::lib::Mocks;
25
use t::lib::Mocks;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
Lines 1147-1152 subtest 'GetAvailability itemcallnumber' => sub { Link Here
1147
    $schema->storage->txn_rollback;
1147
    $schema->storage->txn_rollback;
1148
};
1148
};
1149
1149
1150
subtest 'GetAvailability availabilitystatus' => sub {
1151
    plan tests => 4;
1152
1153
    $schema->storage->txn_begin;
1154
    my $item = $builder->build_sample_item;
1155
1156
    my ( $cgi, $reply, $xml, $status, $message );
1157
    $cgi = CGI->new;
1158
    $cgi->param( service => 'GetAvailability' );
1159
    $cgi->param( id      => $item->biblionumber );
1160
    $cgi->param( id_type => 'biblio' );
1161
    $reply  = C4::ILSDI::Services::GetAvailability($cgi);
1162
    $xml    = XML::LibXML->load_xml( string => $reply );
1163
    $status = $xml->findnodes('//dlf:availabilitystatus')->to_literal();
1164
    is( $status, 'available', 'GetAvailability returns available' );
1165
1166
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
1167
    $patron->branchcode( $item->holdingbranch )->store;
1168
    AddReserve(
1169
        {
1170
            reservation_date => dt_from_string()->add( days => 1 ),
1171
            branchcode       => $item->holdingbranch,
1172
            borrowernumber   => $patron->id,
1173
            biblionumber     => $item->biblionumber,
1174
            itemnumber       => $item->itemnumber,
1175
        }
1176
    );
1177
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
1178
    $reply  = C4::ILSDI::Services::GetAvailability($cgi);
1179
    $xml    = XML::LibXML->load_xml( string => $reply );
1180
    $status = $xml->findnodes('//dlf:availabilitystatus')->to_literal();
1181
    is( $status, 'available', 'GetAvailability returns available, ignoring future hold' );
1182
1183
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 );
1184
    $reply   = C4::ILSDI::Services::GetAvailability($cgi);
1185
    $xml     = XML::LibXML->load_xml( string => $reply );
1186
    $status  = $xml->findnodes('//dlf:availabilitystatus')->to_literal();
1187
    $message = $xml->findnodes('//dlf:availabilitymsg')->to_literal();
1188
    is( $status,  'not available', 'GetAvailability returns not available status for future hold' );
1189
    is( $message, 'On hold',       'GetAvailability returns on hold message for future hold' );
1190
1191
    t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 );
1192
    $schema->storage->txn_rollback;
1193
};
1194
1150
subtest 'Bug 34893: ILS-DI can return the wrong patron for AuthenticatePatron' => sub {
1195
subtest 'Bug 34893: ILS-DI can return the wrong patron for AuthenticatePatron' => sub {
1151
1196
1152
    plan tests => 2;
1197
    plan tests => 2;
1153
- 

Return to bug 37651