Lines 2675-2684
subtest 'lock' => sub {
Link Here
|
2675 |
}; |
2675 |
}; |
2676 |
|
2676 |
|
2677 |
subtest 'anonymize' => sub { |
2677 |
subtest 'anonymize' => sub { |
2678 |
plan tests => 10; |
2678 |
plan tests => 11; |
2679 |
|
2679 |
|
2680 |
my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); |
2680 |
my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } )->store; |
2681 |
my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); |
2681 |
my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } )->store; |
2682 |
|
2682 |
|
2683 |
# First try patron with issues |
2683 |
# First try patron with issues |
2684 |
my $issue = $builder->build_object( |
2684 |
my $issue = $builder->build_object( |
Lines 2696-2711
subtest 'anonymize' => sub {
Link Here
|
2696 |
is( $patron1->firstname, undef, 'First name cleared' ); |
2696 |
is( $patron1->firstname, undef, 'First name cleared' ); |
2697 |
isnt( $patron1->surname, $surname, 'Surname changed' ); |
2697 |
isnt( $patron1->surname, $surname, 'Surname changed' ); |
2698 |
ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' ); |
2698 |
ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' ); |
2699 |
is( $patron1->branchcode, $branchcode, 'Branch code skipped' ); |
2699 |
is( $patron1->branchcode, $branchcode, 'Branch code skipped' ); |
2700 |
is( $patron1->email, undef, 'Email was mandatory, must be cleared' ); |
2700 |
is( $patron1->email, undef, 'Email was mandatory, must be cleared' ); |
|
|
2701 |
is( $patron1->checkprevcheckout, 'inherit', 'Enum checkprevcheckout is reset to the default value' ); |
2701 |
|
2702 |
|
2702 |
# Test wrapper in Koha::Patrons |
2703 |
# Test wrapper in Koha::Patrons |
2703 |
$patron1->surname($surname)->store; # restore |
2704 |
$patron1->surname($surname)->store; # restore |
2704 |
my $rs = Koha::Patrons->search( { borrowernumber => [ $patron1->borrowernumber, $patron2->borrowernumber ] } ) |
2705 |
my $rs = Koha::Patrons->search( { borrowernumber => [ $patron1->borrowernumber, $patron2->borrowernumber ] } ) |
2705 |
->anonymize; |
2706 |
->anonymize; |
2706 |
$patron1->discard_changes; # refresh |
2707 |
$patron1->discard_changes; # refresh |
2707 |
isnt( $patron1->surname, $surname, 'Surname patron1 changed again' ); |
2708 |
isnt( $patron1->surname, $surname, 'Surname patron1 changed again' ); |
2708 |
$patron2->discard_changes; # refresh |
2709 |
$patron2->discard_changes; # refresh |
2709 |
is( $patron2->firstname, undef, 'First name patron2 cleared' ); |
2710 |
is( $patron2->firstname, undef, 'First name patron2 cleared' ); |
2710 |
}; |
2711 |
}; |
2711 |
|
2712 |
|
2712 |
- |
|
|