View | Details | Raw Unified | Return to bug 21336
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patrons.t (-2 / +5 lines)
Lines 1121-1127 subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited Link Here
1121
};
1121
};
1122
1122
1123
subtest 'account_locked' => sub {
1123
subtest 'account_locked' => sub {
1124
    plan tests => 9;
1124
    plan tests => 13;
1125
    my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } });
1125
    my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } });
1126
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
1126
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
1127
    for my $value ( undef, '', 0 ) {
1127
    for my $value ( undef, '', 0 ) {
Lines 1129-1134 subtest 'account_locked' => sub { Link Here
1129
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1129
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1130
        $patron->login_attempts(1)->store;
1130
        $patron->login_attempts(1)->store;
1131
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1131
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1132
        $patron->login_attempts(-1)->store;
1133
        is( $patron->account_locked, 1, 'Feature is disabled but administrative lockout has been triggered' );
1132
    }
1134
    }
1133
1135
1134
    t::lib::Mocks::mock_preference('FailedloginAttempts', 3);
1136
    t::lib::Mocks::mock_preference('FailedloginAttempts', 3);
Lines 1138-1143 subtest 'account_locked' => sub { Link Here
1138
    is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' );
1140
    is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' );
1139
    $patron->login_attempts(4)->store;
1141
    $patron->login_attempts(4)->store;
1140
    is( $patron->account_locked, 1, 'Patron could not have 4 failed attempts, but account should still be considered locked' );
1142
    is( $patron->account_locked, 1, 'Patron could not have 4 failed attempts, but account should still be considered locked' );
1143
    $patron->login_attempts(-1)->store;
1144
    is( $patron->account_locked, 1, 'Administrative lockout triggered' );
1141
1145
1142
    $patron->delete;
1146
    $patron->delete;
1143
};
1147
};
1144
- 

Return to bug 21336