Koha/t/db_dependent/SIP/Patron.t
Marcel de Rooy 7ce9008a00 Bug 15956: Rearranging some SIP unit tests
The original SIP_ILS.t is split up into SIP/Patron.t and
SIP/Transaction.t.
The assumption on a hardcoded existing and non-existing card number is
replaced by adding and deleting a card number (:patron) with TestBuilder.

Test plan:
Run SIP/Patron.t
Run SIP/Transaction.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-04-29 13:38:33 +00:00

29 lines
831 B
Perl
Executable file

#!/usr/bin/perl
# Some tests for SIP::ILS::Patron
# This needs to be extended! Your help is appreciated..
use Modern::Perl;
use Test::More tests => 2;
use Koha::Database;
use t::lib::TestBuilder;
use C4::SIP::ILS::Patron;
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
my $builder = t::lib::TestBuilder->new();
my $patron1 = $builder->build({ source => 'Borrower' });
my $card = $patron1->{cardnumber};
# Check existing card number
my $sip_patron = C4::SIP::ILS::Patron->new( $card );
is( defined $sip_patron, 1, "Patron is valid" );
# Check invalid cardnumber by deleting patron
$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)" );
$schema->storage->txn_rollback;