[Koha-bugs] [Bug 18146] New: C4:: Circulation CanBookBeRenewed lacks full test coverage.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 20 17:02:50 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18146

            Bug ID: 18146
           Summary: C4::Circulation CanBookBeRenewed  lacks full test
                    coverage.
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Test Suite
          Assignee: chris at bigballofwax.co.nz
          Reporter: mtompset at hotmail.com
        QA Contact: gmcharlt at gmail.com

While testing bug 17941, I discovered two cases where test coverage was lacking
from t/db_dependent/Circulation.t

Around line 2725:
    if ( $restricted and $restrictionblockrenewing ) {
        return ( 0, 'restriction');
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') ||
($itemissue->{overdue} and $overduesblockrenewing eq 'blockitem') ) {
        return ( 0, 'overdue');
    }

The elseif is never triggered.


Around line 2759:
        if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() )
)
        {
            return ( 0, "auto_too_soon" ) if $itemissue->{auto_renew};
            return ( 0, "too_soon" );
        }
        elsif ( $itemissue->{auto_renew} ) {
            return ( 0, "auto_renew" );
        }

There is no else, but the code never attempts something that would trigger one.

To reproduce add:
print STDERR "CHECK!\n";
just before the return ( 0, 'overdue') in the first case, and after the elsif's
curly brace in the second case.

running t/db_dependent/Circulation should not generate the CHECK points.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list