| 
      
            Lines 1582-1588
          subtest 'lock' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1582 | 
          };  | 
          1582 | 
          };  | 
        
        
          | 1583 | 
           | 
          1583 | 
           | 
        
        
          | 1584 | 
          subtest 'anonymize' => sub { | 
          1584 | 
          subtest 'anonymize' => sub { | 
        
          
            
              | 1585 | 
                  plan tests => 9;  | 
              1585 | 
                  plan tests => 10;  | 
            
        
          | 1586 | 
           | 
          1586 | 
           | 
        
        
          | 1587 | 
              my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); | 
          1587 | 
              my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); | 
        
        
          | 1588 | 
              my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); | 
          1588 | 
              my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); | 
        
  
    | 
      
            Lines 1593-1602
          subtest 'anonymize' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1593 | 
              $issue->delete;  | 
          1593 | 
              $issue->delete;  | 
        
        
          | 1594 | 
           | 
          1594 | 
           | 
        
        
          | 1595 | 
              t::lib::Mocks::mock_preference( 'BorrowerMandatoryField', 'surname|email|cardnumber' );  | 
          1595 | 
              t::lib::Mocks::mock_preference( 'BorrowerMandatoryField', 'surname|email|cardnumber' );  | 
        
            
               | 
               | 
              1596 | 
                  t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );  | 
            
        
          | 1596 | 
              my $surname = $patron1->surname; # expect change, no clear  | 
          1597 | 
              my $surname = $patron1->surname; # expect change, no clear  | 
        
        
          | 1597 | 
              my $branchcode = $patron1->branchcode; # expect skip  | 
          1598 | 
              my $branchcode = $patron1->branchcode; # expect skip  | 
        
        
          | 1598 | 
              $patron1->anonymize;  | 
          1599 | 
              $patron1->anonymize;  | 
        
        
          | 1599 | 
              is($patron1->flgAnonymized, 1, 'Check flag' );  | 
          1600 | 
              is($patron1->flgAnonymized, 1, 'Check flag' );  | 
        
            
               | 
               | 
              1601 | 
                  is( $schema->resultset('ActionLog')->search({ object => $patron1->borrowernumber, module => 'MEMBERS', action => 'ANONYMIZE' })->count, 1, 'Action has been logged too' ); | 
            
        
          | 1600 | 
           | 
          1602 | 
           | 
        
        
          | 1601 | 
              is( $patron1->dateofbirth, undef, 'Birth date cleared' );  | 
          1603 | 
              is( $patron1->dateofbirth, undef, 'Birth date cleared' );  | 
        
        
          | 1602 | 
              is( $patron1->firstname, undef, 'First name cleared' );  | 
          1604 | 
              is( $patron1->firstname, undef, 'First name cleared' );  | 
        
            
              | 1603 | 
              -   | 
               | 
               |