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

(-)a/t/db_dependent/Koha/Patrons.t (-3 / +13 lines)
Lines 1925-1939 subtest '->store' => sub { Link Here
1925
1925
1926
subtest '->set_password' => sub {
1926
subtest '->set_password' => sub {
1927
1927
1928
    plan tests => 14;
1928
    plan tests => 16;
1929
1929
1930
    $schema->storage->txn_begin;
1930
    $schema->storage->txn_begin;
1931
1931
1932
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { login_attempts => 3 } } );
1932
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { login_attempts => 3 } } );
1933
1933
1934
    # Disable logging password changes for this tests
1934
    # Disable logging password changes for these tests
1935
    t::lib::Mocks::mock_preference( 'BorrowersLog', 0 );
1935
    t::lib::Mocks::mock_preference( 'BorrowersLog', 0 );
1936
1936
1937
    # Disable notifying patrons of password changes for these tests
1938
    t::lib::Mocks::mock_preference( 'NotifyPasswordChange', 0 );
1939
1937
    # Password-length tests
1940
    # Password-length tests
1938
    t::lib::Mocks::mock_preference( 'minPasswordLength', undef );
1941
    t::lib::Mocks::mock_preference( 'minPasswordLength', undef );
1939
    throws_ok { $patron->set_password({ password => 'ab' }); }
1942
    throws_ok { $patron->set_password({ password => 'ab' }); }
Lines 1998-2003 subtest '->set_password' => sub { Link Here
1998
    $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count;
2001
    $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count;
1999
    is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->set_password does log password changes' );
2002
    is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->set_password does log password changes' );
2000
2003
2004
    # Enable notifying patrons of password changes
2005
    t::lib::Mocks::mock_preference( 'NotifyPasswordChange', 1 );
2006
    $patron->set_password({ password => 'abcd   c' });
2007
    my $queued_notices = Koha::Notice::Messages->search({ borrowernumber => $patron->borrowernumber });
2008
    is( $queued_notices->count, 1, "One notice queued when NotifyPassowrdChange enabled" );
2009
    my $THE_notice = $queued_notices->next;
2010
    is( $THE_notice->status, 'failed', "The notice was sent immediately");
2011
2001
    $schema->storage->txn_rollback;
2012
    $schema->storage->txn_rollback;
2002
};
2013
};
2003
2014
2004
- 

Return to bug 25936