|
Lines 503-509
subtest 'renew_account' => sub {
Link Here
|
| 503 |
my $number_of_logs = |
503 |
my $number_of_logs = |
| 504 |
$schema->resultset('ActionLog') |
504 |
$schema->resultset('ActionLog') |
| 505 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
505 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
| 506 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->renew_account should have logged' ); |
506 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->renew_account should have logged' ); |
| 507 |
|
507 |
|
| 508 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
508 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
| 509 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); |
509 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); |
|
Lines 519-525
subtest 'renew_account' => sub {
Link Here
|
| 519 |
$number_of_logs = |
519 |
$number_of_logs = |
| 520 |
$schema->resultset('ActionLog') |
520 |
$schema->resultset('ActionLog') |
| 521 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
521 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
| 522 |
is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->renew_account should not have logged' ); |
522 |
is( $number_of_logs, 1, 'Without BorrowersLog, Koha::Patron->renew_account should not have logged' ); |
| 523 |
|
523 |
|
| 524 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' ); |
524 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' ); |
| 525 |
$expiry_date = $retrieved_patron_2->renew_account; |
525 |
$expiry_date = $retrieved_patron_2->renew_account; |
|
Lines 655-661
subtest "delete" => sub {
Link Here
|
| 655 |
my $number_of_logs = |
655 |
my $number_of_logs = |
| 656 |
$schema->resultset('ActionLog') |
656 |
$schema->resultset('ActionLog') |
| 657 |
->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } )->count; |
657 |
->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } )->count; |
| 658 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->delete should have logged' ); |
658 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->delete should have logged' ); |
| 659 |
|
659 |
|
| 660 |
# Test deletion with designated fallback owner |
660 |
# Test deletion with designated fallback owner |
| 661 |
my $designated_owner = $builder->build_object( { class => 'Koha::Patrons' } ); |
661 |
my $designated_owner = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
Lines 2038-2050
subtest 'BorrowersLog and CardnumberLog tests' => sub {
Link Here
|
| 2038 |
my $log_info = from_json( $logs[0]->info ); |
2038 |
my $log_info = from_json( $logs[0]->info ); |
| 2039 |
is( $log_info->{cardnumber}->{after}, 'TESTCARDNUMBER', 'Got correct new cardnumber' ); |
2039 |
is( $log_info->{cardnumber}->{after}, 'TESTCARDNUMBER', 'Got correct new cardnumber' ); |
| 2040 |
is( $log_info->{cardnumber}->{before}, $cardnumber, 'Got correct old cardnumber' ); |
2040 |
is( $log_info->{cardnumber}->{before}, $cardnumber, 'Got correct old cardnumber' ); |
| 2041 |
is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' ); |
2041 |
is( scalar @logs, 1, 'With BorrowersLog, one detailed MODIFY action should be logged for the modification.' ); |
| 2042 |
|
2042 |
|
| 2043 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' ); |
2043 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' ); |
| 2044 |
$patron->update_lastseen('connection'); |
2044 |
$patron->update_lastseen('connection'); |
| 2045 |
@logs = $schema->resultset('ActionLog') |
2045 |
@logs = $schema->resultset('ActionLog') |
| 2046 |
->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } ); |
2046 |
->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } ); |
| 2047 |
is( scalar @logs, 1, 'With BorrowerLogs and TrackLastPatronActivityTriggers we should not spam the logs' ); |
2047 |
is( scalar @logs, 1, 'With BorrowersLog and TrackLastPatronActivityTriggers we should not spam the logs' ); |
| 2048 |
|
2048 |
|
| 2049 |
# Clear the logs for this patron |
2049 |
# Clear the logs for this patron |
| 2050 |
Koha::ActionLogs->search( { object => $patron->borrowernumber } )->delete(); |
2050 |
Koha::ActionLogs->search( { object => $patron->borrowernumber } )->delete(); |
|
Lines 2474-2480
subtest '->set_password' => sub {
Link Here
|
| 2474 |
my $number_of_logs = |
2474 |
my $number_of_logs = |
| 2475 |
$schema->resultset('ActionLog') |
2475 |
$schema->resultset('ActionLog') |
| 2476 |
->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count; |
2476 |
->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count; |
| 2477 |
is( $number_of_logs, 0, 'Without BorrowerLogs, Koha::Patron->set_password doesn\'t log password changes' ); |
2477 |
is( $number_of_logs, 0, 'Without BorrowersLog, Koha::Patron->set_password doesn\'t log password changes' ); |
| 2478 |
|
2478 |
|
| 2479 |
# Enable logging password changes |
2479 |
# Enable logging password changes |
| 2480 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
2480 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
|
Lines 2486-2492
subtest '->set_password' => sub {
Link Here
|
| 2486 |
object => $patron->borrowernumber |
2486 |
object => $patron->borrowernumber |
| 2487 |
} |
2487 |
} |
| 2488 |
)->count; |
2488 |
)->count; |
| 2489 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->set_password does log password changes' ); |
2489 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->set_password does log password changes' ); |
| 2490 |
|
2490 |
|
| 2491 |
# add other action name |
2491 |
# add other action name |
| 2492 |
$patron->set_password( { password => 'abcd b2', action => 'RESET PASS' } ); |
2492 |
$patron->set_password( { password => 'abcd b2', action => 'RESET PASS' } ); |
| 2493 |
- |
|
|