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

(-)a/t/db_dependent/Koha/Patrons.t (-2 / +21 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 21;
22
use Test::More tests => 22;
23
use Test::Warn;
23
use Test::Warn;
24
use DateTime;
24
use DateTime;
25
25
Lines 881-886 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
881
    Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete;
881
    Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete;
882
};
882
};
883
883
884
subtest 'account_locked' => sub {
885
    plan tests => 8;
886
    my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } });
887
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
888
    for my $value ( undef, '', 0 ) {
889
        t::lib::Mocks::mock_preference('FailedloginAttempts', $value);
890
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
891
        $patron->login_attempts(1)->store;
892
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
893
    }
894
895
    t::lib::Mocks::mock_preference('FailedloginAttempts', 3);
896
    $patron->login_attempts(2)->store;
897
    is( $patron->account_locked, 0, 'Patron has 2 failed attempts, account should not be considered locked yet' );
898
    $patron->login_attempts(3)->store;
899
    is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' );
900
901
    $patron->delete;
902
};
903
884
$retrieved_patron_1->delete;
904
$retrieved_patron_1->delete;
885
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
905
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
886
906
887
- 

Return to bug 18314