|
|
@ -21,7 +21,7 @@ |
|
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
|
|
|
|
|
|
|
use Modern::Perl; |
|
|
|
use Test::More tests => 4; |
|
|
|
use Test::More tests => 5; |
|
|
|
use Test::MockObject; |
|
|
|
use Test::MockModule; |
|
|
|
use Test::Warn; |
|
|
@ -73,6 +73,15 @@ subtest 'Checkin V2' => sub { |
|
|
|
$schema->storage->txn_rollback; |
|
|
|
}; |
|
|
|
|
|
|
|
subtest 'Test hold_patron_bcode' => sub { |
|
|
|
my $schema = Koha::Database->new->schema; |
|
|
|
$schema->storage->txn_begin; |
|
|
|
plan tests => 2; |
|
|
|
$C4::SIP::Sip::protocol_version = 2; |
|
|
|
test_hold_patron_bcode(); |
|
|
|
$schema->storage->txn_rollback; |
|
|
|
}; |
|
|
|
|
|
|
|
subtest 'Lastseen response' => sub { |
|
|
|
|
|
|
|
my $schema = Koha::Database->new->schema; |
|
|
@ -468,6 +477,27 @@ sub test_checkin_v2 { |
|
|
|
'Issue record is gone now' ); |
|
|
|
} |
|
|
|
|
|
|
|
sub test_hold_patron_bcode { |
|
|
|
my $builder = t::lib::TestBuilder->new(); |
|
|
|
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
|
|
|
my ( $response, $findpatron ); |
|
|
|
my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); |
|
|
|
|
|
|
|
my $item = $builder->build({ |
|
|
|
source => 'Item', |
|
|
|
value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode }, |
|
|
|
}); |
|
|
|
my $item_object = Koha::Items->find( $item->{itemnumber} ); |
|
|
|
|
|
|
|
my $server = { ils => $mocks->{ils} }; |
|
|
|
my $sip_item = C4::SIP::ILS::Item->new( $item->{barcode} ); |
|
|
|
|
|
|
|
is( $sip_item->hold_patron_bcode, q{}, "SIP item with no hold returns empty string" ); |
|
|
|
|
|
|
|
my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_bcode, $server ); |
|
|
|
is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); |
|
|
|
} |
|
|
|
|
|
|
|
# Helper routines |
|
|
|
|
|
|
|
sub create_mocks { |
|
|
|