Koha/t/db_dependent/SIP/Transaction.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

28 lines
939 B
Perl
Executable file

#!/usr/bin/perl
# Tests for SIP::ILS::Transaction
# Current state is very rudimentary. Please help to extend it!
use Modern::Perl;
use Test::More tests => 3;
use Koha::Database;
use t::lib::TestBuilder;
use C4::SIP::ILS::Patron;
use C4::SIP::ILS::Transaction::RenewAll;
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
my $builder = t::lib::TestBuilder->new();
my $borr1 = $builder->build({ source => 'Borrower' });
my $card = $borr1->{cardnumber};
my $sip_patron = C4::SIP::ILS::Patron->new( $card );
# Create transaction RenewAll, assign patron, and run (no items)
my $transaction = C4::SIP::ILS::Transaction::RenewAll->new();
is( ref $transaction, "C4::SIP::ILS::Transaction::RenewAll", "New transaction created" );
is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" );
isnt( $transaction->do_renew_all, undef, "RenewAll on zero items" );
$schema->storage->txn_rollback;