Bug 26457: Unit test

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e05ad0c1f8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2020-12-24 12:22:49 +00:00 committed by Fridolin Somers
parent eb955e8940
commit df53867563
2 changed files with 9 additions and 2 deletions

View File

@ -3040,8 +3040,10 @@ sub AddRenewal {
AND itemnumber=?"
);
eval{
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $borrowernumber, $itemnumber );
if ( $sth->err ){
};
if( $sth->err ){
Koha::Exceptions::Checkout::FailedRenewal->throw(
error => 'Update of issue# ' . $issue->issue_id . ' failed with error: ' . $sth->errstr
);

View File

@ -3739,7 +3739,7 @@ subtest 'AddReturn should clear items.onloan for unissued items' => sub {
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
plan tests => 12;
plan tests => 13;
t::lib::Mocks::mock_preference('item-level_itypes', 1);
@ -3782,6 +3782,11 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub {
# Check the item out
AddIssue( $patron->unblessed, $item->barcode );
throws_ok {
AddRenewal( $patron->borrowernumber, $item->itemnumber, $library->id, undef, {break=>"the_renewal"} );
} 'Koha::Exceptions::Checkout::FailedRenewal', 'Exception is thrown when renewal update to issues fails';
t::lib::Mocks::mock_preference( 'RenewalLog', 0 );
my $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );
my %params_renewal = (