Bug 12225: Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
3b0bc03ad4
commit
df22b78f53
1 changed files with 38 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
# Current state is very rudimentary. Please help to extend it!
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 15;
|
||||
use Test::More tests => 16;
|
||||
|
||||
use Koha::Database;
|
||||
use t::lib::TestBuilder;
|
||||
|
@ -529,6 +529,43 @@ subtest do_checkout_with_patron_blocked => sub {
|
|||
|
||||
};
|
||||
|
||||
subtest do_checkout_with_noblock => sub {
|
||||
plan tests => 3;
|
||||
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
my $patron = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patrons',
|
||||
value => {
|
||||
branchcode => $library->branchcode,
|
||||
debarred => '9999/01/01',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
t::lib::Mocks::mock_userenv(
|
||||
{ branchcode => $library->branchcode, flags => 1 } );
|
||||
|
||||
my $item = $builder->build_sample_item(
|
||||
{
|
||||
library => $library->branchcode,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
|
||||
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
|
||||
my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new();
|
||||
is( $co_transaction->patron($sip_patron),
|
||||
$sip_patron, "Patron assigned to transaction" );
|
||||
is( $co_transaction->item($sip_item),
|
||||
$sip_item, "Item assigned to transaction" );
|
||||
|
||||
$co_transaction->do_checkout(undef, '19990102 030405');
|
||||
|
||||
is( $patron->checkouts->count, 1, 'No Block checkout was performed for debarred patron');
|
||||
};
|
||||
|
||||
subtest do_checkout_with_holds => sub {
|
||||
plan tests => 7;
|
||||
|
||||
|
|
Loading…
Reference in a new issue