From 845a15f80b56c8e64273d6557e1ffaf2e64603ee Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 18 Jun 2020 16:54:42 -0300 Subject: [PATCH] Bug 25805: Regression tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/SIP/Message.t | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t index 75ecb7f3364..e3a81c54cdc 100755 --- a/t/db_dependent/SIP/Message.t +++ b/t/db_dependent/SIP/Message.t @@ -21,7 +21,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 5; +use Test::More tests => 6; use Test::MockObject; use Test::MockModule; use Test::Warn; @@ -82,6 +82,41 @@ subtest 'Test hold_patron_bcode' => sub { $schema->storage->txn_rollback; }; +subtest 'hold_patron_name() tests' => sub { + + plan tests => 2; + + my $schema = Koha::Database->new->schema; + $schema->storage->txn_begin; + + 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_sample_item( + { + damaged => 0, + withdrawn => 0, + itemlost => 0, + restricted => 0, + homebranch => $branchcode, + holdingbranch => $branchcode + } + ); + + my $server = { ils => $mocks->{ils} }; + my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); + + is( $sip_item->hold_patron_name, q{}, "SIP item with no hold returns empty string for patron name" ); + + my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_name, $server ); + is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); + + $schema->storage->txn_rollback; +}; + subtest 'Lastseen response' => sub { my $schema = Koha::Database->new->schema; -- 2.27.0