Lines 21-27
Link Here
|
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
22 |
|
22 |
|
23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
24 |
use Test::More tests => 4; |
24 |
use Test::More tests => 5; |
25 |
use Test::MockObject; |
25 |
use Test::MockObject; |
26 |
use Test::MockModule; |
26 |
use Test::MockModule; |
27 |
use Test::Warn; |
27 |
use Test::Warn; |
Lines 73-78
subtest 'Checkin V2' => sub {
Link Here
|
73 |
$schema->storage->txn_rollback; |
73 |
$schema->storage->txn_rollback; |
74 |
}; |
74 |
}; |
75 |
|
75 |
|
|
|
76 |
subtest 'Test hold_patron_bcode' => sub { |
77 |
my $schema = Koha::Database->new->schema; |
78 |
$schema->storage->txn_begin; |
79 |
plan tests => 2; |
80 |
$C4::SIP::Sip::protocol_version = 2; |
81 |
test_hold_patron_bcode(); |
82 |
$schema->storage->txn_rollback; |
83 |
}; |
84 |
|
76 |
subtest 'Lastseen response' => sub { |
85 |
subtest 'Lastseen response' => sub { |
77 |
|
86 |
|
78 |
my $schema = Koha::Database->new->schema; |
87 |
my $schema = Koha::Database->new->schema; |
Lines 468-473
sub test_checkin_v2 {
Link Here
|
468 |
'Issue record is gone now' ); |
477 |
'Issue record is gone now' ); |
469 |
} |
478 |
} |
470 |
|
479 |
|
|
|
480 |
sub test_hold_patron_bcode { |
481 |
my $builder = t::lib::TestBuilder->new(); |
482 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
483 |
my ( $response, $findpatron ); |
484 |
my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); |
485 |
|
486 |
my $item = $builder->build({ |
487 |
source => 'Item', |
488 |
value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode }, |
489 |
}); |
490 |
my $item_object = Koha::Items->find( $item->{itemnumber} ); |
491 |
|
492 |
my $server = { ils => $mocks->{ils} }; |
493 |
my $sip_item = C4::SIP::ILS::Item->new( $item->{barcode} ); |
494 |
|
495 |
is( $sip_item->hold_patron_bcode, q{}, "SIP item with no hold returns empty string" ); |
496 |
|
497 |
my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_bcode, $server ); |
498 |
is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); |
499 |
} |
500 |
|
471 |
# Helper routines |
501 |
# Helper routines |
472 |
|
502 |
|
473 |
sub create_mocks { |
503 |
sub create_mocks { |
474 |
- |
|
|