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

(-)a/t/db_dependent/Koha/Patrons.t (-2 / +20 lines)
Lines 19-28 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 25;
22
use Test::More tests => 26;
23
use Test::Warn;
23
use Test::Warn;
24
use Time::Fake;
24
use Time::Fake;
25
use DateTime;
25
use DateTime;
26
use JSON;
26
27
27
use C4::Biblio;
28
use C4::Biblio;
28
use C4::Circulation;
29
use C4::Circulation;
Lines 1121-1126 subtest 'is_child | is_adult' => sub { Link Here
1121
$retrieved_patron_1->delete;
1122
$retrieved_patron_1->delete;
1122
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
1123
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
1123
1124
1125
subtest 'Log cardnumber change' => sub {
1126
    plan tests => 3;
1127
1128
    t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );
1129
    my $patron = $builder->build( { source => 'Borrower' } );
1130
1131
    my $cardnumber = $patron->{cardnumber};
1132
    $patron->{cardnumber} = 'TESTCARDNUMBER';
1133
    ModMember(%$patron);
1134
1135
    my @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->{borrowernumber} } );
1136
    my $log_info = from_json( $logs[0]->info );
1137
    is( $log_info->{cardnumber_replaced}->{new_cardnumber}, 'TESTCARDNUMBER', 'Got correct new cardnumber' );
1138
    is( $log_info->{cardnumber_replaced}->{previous_cardnumber}, $cardnumber, 'Got correct old cardnumber' );
1139
    is( scalar @logs, 2, 'With BorrowerLogs, Change in cardnumber should be logged, as well as general alert of patron mod.' );
1140
};
1141
1142
1124
$schema->storage->txn_rollback;
1143
$schema->storage->txn_rollback;
1125
1144
1126
# TODO Move to t::lib::Mocks and reuse it!
1145
# TODO Move to t::lib::Mocks and reuse it!
1127
- 

Return to bug 18626