Bug 21468: (QA follow-up) Enhance tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
614b64ed17
commit
a658db8f7e
|
|
@ -22,7 +22,7 @@ use Test::Warn;
|
|||
|
||||
use File::Basename;
|
||||
|
||||
use C4::Circulation qw(AddIssue AddRenewal);
|
||||
use C4::Circulation qw(AddIssue AddRenewal AddReturn);
|
||||
|
||||
use t::lib::Mocks;
|
||||
use t::lib::TestBuilder;
|
||||
|
|
@ -92,8 +92,7 @@ subtest 'after_circ_action() hook tests' => sub {
|
|||
plan tests => 1;
|
||||
|
||||
warning_like {
|
||||
AddReturn( $patron->borrowernumber, $item->id,
|
||||
$patron->branchcode );
|
||||
AddReturn( $item->barcode, $patron->branchcode );
|
||||
}
|
||||
qr/after_circ_action called with action: checkin, ref: DateTime/,
|
||||
'AddReturn calls the after_circ_action hook';
|
||||
|
|
|
|||
|
|
@ -165,8 +165,27 @@ sub after_circ_action {
|
|||
|
||||
my $action = $params->{action};
|
||||
my $checkout = $params->{payload}->{checkout};
|
||||
my $payload = $params->{payload};
|
||||
|
||||
Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout));
|
||||
my $renewal_library_id = $payload->{renewal_library_id};
|
||||
my $charge = $payload->{charge};
|
||||
my $item_id = $payload->{item_id};
|
||||
my $item_type = $payload->{item_type};
|
||||
my $shelving_location = $payload->{shelving_location};
|
||||
my $patron_id = $payload->{patron_id};
|
||||
my $collection_code = $payload->{collection_code};
|
||||
my $date_due = $payload->{date_due};
|
||||
my $date_returned = $payload->{date_returned};
|
||||
|
||||
if ( $action eq 'renewal' ) {
|
||||
Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout));
|
||||
}
|
||||
elsif ( $action eq 'checkout') {
|
||||
Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($date_due));
|
||||
}
|
||||
elsif ( $action eq 'checkin' ) {
|
||||
Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($date_returned));
|
||||
}
|
||||
}
|
||||
|
||||
sub api_routes {
|
||||
|
|
|
|||
Loading…
Reference in New Issue