Bug 25805: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomás Cohen Arazi 2020-06-18 16:54:42 -03:00 committed by Jonathan Druart
parent ee3f5d5a85
commit 115eeada2b

View file

@ -21,7 +21,7 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
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;