Bug 38284: Add tests

Sponsored-by: PTFS Europe <https://ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5acf88d91d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2024-10-29 09:23:31 +00:00 committed by Lucas Gass
parent d444b97d03
commit 41e74dd1a1
1 changed files with 38 additions and 1 deletions

View File

@ -21,7 +21,7 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Test::More tests => 20;
use Test::More tests => 21;
use Test::Exception;
use Test::MockObject;
use Test::MockModule;
@ -408,6 +408,43 @@ subtest 'Lastseen response patron status' => sub {
};
subtest 'Invalid cardnumber test response patron status' => sub {
plan tests => 1;
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 $cardnum = 'nonexistentcardnumber';
my $sip_patron = C4::SIP::ILS::Patron->new($cardnum);
$findpatron = $sip_patron;
my $siprequest =
PATRON_STATUS_REQ
. 'engYYYYMMDDZZZZHHMMSS'
. FID_INST_ID
. $branchcode . '|'
. FID_PATRON_ID
. $cardnum . '|'
. FID_PATRON_PWD
. PATRON_PW . '|';
my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
my $server = { ils => $mocks->{ils} };
undef $response;
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login' );
$msg->handle_patron_status($server);
isnt( $response, undef, 'At least we got a response.' );
$schema->storage->txn_rollback;
};
subtest "Test build_additional_item_fields_string" => sub {
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;