Bug 27014: (QA follow-up) Add regression tests

This patch adds a regression test for the change introduced in the
patchset.

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:
Martin Renvoize 2021-01-12 11:15:28 +00:00 committed by Jonathan Druart
parent 05e16389ef
commit d9c6365793

View file

@ -4,7 +4,7 @@
# This needs to be extended! Your help is appreciated..
use Modern::Perl;
use Test::More tests => 7;
use Test::More tests => 8;
use t::lib::Mocks;
use t::lib::TestBuilder;
@ -32,6 +32,32 @@ $schema->resultset('Borrower')->search({ cardnumber => $card })->delete;
my $sip_patron2 = C4::SIP::ILS::Patron->new( $card );
is( $sip_patron2, undef, "Patron is not valid (anymore)" );
subtest "new tests" => sub {
plan tests => 5;
my $patron = $builder->build(
{
source => 'Borrower'
}
);
my $cardnumber = $patron->{cardnumber};
my $userid = $patron->{userid};
my $borrowernumber = $patron->{borrowernumber};
my $ils_patron = C4::SIP::ILS::Patron->new($cardnumber);
is( ref($ils_patron), 'C4::SIP::ILS::Patron', 'Found patron via cardnumber scalar' );
$ils_patron = C4::SIP::ILS::Patron->new($userid);
is( ref($ils_patron), 'C4::SIP::ILS::Patron', 'Found patron via userid scalar' );
$ils_patron = C4::SIP::ILS::Patron->new( { borrowernumber => $borrowernumber } );
is( ref($ils_patron), 'C4::SIP::ILS::Patron', 'Found patron via borrowernumber hashref' );
$ils_patron = C4::SIP::ILS::Patron->new( { cardnumber => $cardnumber } );
is( ref($ils_patron), 'C4::SIP::ILS::Patron', 'Found patron via cardnumber hashref' );
$ils_patron = C4::SIP::ILS::Patron->new( { userid => $userid } );
is( ref($ils_patron), 'C4::SIP::ILS::Patron', 'Found patron via userid hashref' );
};
subtest "OverduesBlockCirc tests" => sub {
plan tests => 6;