Lines 1663-1671
subtest 'search_anonymize_candidates' => sub {
Link Here
|
1663 |
plan tests => 5; |
1663 |
plan tests => 5; |
1664 |
my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); |
1664 |
my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); |
1665 |
my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); |
1665 |
my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); |
1666 |
$patron1->flgAnonymized(0); |
1666 |
$patron1->anonymized(0); |
1667 |
$patron1->dateexpiry( dt_from_string->add(days => 1) )->store; |
1667 |
$patron1->dateexpiry( dt_from_string->add(days => 1) )->store; |
1668 |
$patron2->flgAnonymized(undef); |
1668 |
$patron2->anonymized(0); |
1669 |
$patron2->dateexpiry( dt_from_string->add(days => 1) )->store; |
1669 |
$patron2->dateexpiry( dt_from_string->add(days => 1) )->store; |
1670 |
|
1670 |
|
1671 |
t::lib::Mocks::mock_preference( 'PatronAnonymizeDelay', q{} ); |
1671 |
t::lib::Mocks::mock_preference( 'PatronAnonymizeDelay', q{} ); |
Lines 1713-1721
subtest 'search_anonymized' => sub {
Link Here
|
1713 |
|
1713 |
|
1714 |
t::lib::Mocks::mock_preference( 'PatronRemovalDelay', 1 ); |
1714 |
t::lib::Mocks::mock_preference( 'PatronRemovalDelay', 1 ); |
1715 |
$patron1->dateexpiry( dt_from_string ); |
1715 |
$patron1->dateexpiry( dt_from_string ); |
1716 |
$patron1->flgAnonymized(0)->store; |
1716 |
$patron1->anonymized(0)->store; |
1717 |
my $cnt = Koha::Patrons->search_anonymized->count; |
1717 |
my $cnt = Koha::Patrons->search_anonymized->count; |
1718 |
$patron1->flgAnonymized(1)->store; |
1718 |
$patron1->anonymized(1)->store; |
1719 |
is( Koha::Patrons->search_anonymized->count, $cnt, 'Number unchanged' ); |
1719 |
is( Koha::Patrons->search_anonymized->count, $cnt, 'Number unchanged' ); |
1720 |
$patron1->dateexpiry( dt_from_string->subtract(days => 1) )->store; |
1720 |
$patron1->dateexpiry( dt_from_string->subtract(days => 1) )->store; |
1721 |
is( Koha::Patrons->search_anonymized->count, $cnt+1, 'Found patron1' ); |
1721 |
is( Koha::Patrons->search_anonymized->count, $cnt+1, 'Found patron1' ); |
Lines 1775-1781
subtest 'anonymize' => sub {
Link Here
|
1775 |
my $surname = $patron1->surname; # expect change, no clear |
1775 |
my $surname = $patron1->surname; # expect change, no clear |
1776 |
my $branchcode = $patron1->branchcode; # expect skip |
1776 |
my $branchcode = $patron1->branchcode; # expect skip |
1777 |
$patron1->anonymize; |
1777 |
$patron1->anonymize; |
1778 |
is($patron1->flgAnonymized, 1, 'Check flag' ); |
1778 |
is($patron1->anonymized, 1, 'Check flag' ); |
1779 |
|
1779 |
|
1780 |
is( $patron1->dateofbirth, undef, 'Birth date cleared' ); |
1780 |
is( $patron1->dateofbirth, undef, 'Birth date cleared' ); |
1781 |
is( $patron1->firstname, undef, 'First name cleared' ); |
1781 |
is( $patron1->firstname, undef, 'First name cleared' ); |
1782 |
- |
|
|