| 
      
            Lines 17-27
          
      
      
        Link Here
      
     | 
  
        
          | 17 | 
           | 
          17 | 
           | 
        
        
          | 18 | 
          use Modern::Perl;  | 
          18 | 
          use Modern::Perl;  | 
        
        
          | 19 | 
           | 
          19 | 
           | 
        
          
            
              | 20 | 
              use Test::More tests => 13;  | 
              20 | 
              use Test::More tests => 17;  | 
            
        
          | 21 | 
          use Test::Warn;  | 
          21 | 
          use Test::Warn;  | 
        
        
          | 22 | 
           | 
          22 | 
           | 
        
        
          | 23 | 
          use C4::Context;  | 
          23 | 
          use C4::Context;  | 
        
        
          | 24 | 
          use Koha::Database;  | 
          24 | 
          use Koha::Database;  | 
        
            
               | 
               | 
              25 | 
              use Koha::DateUtils;  | 
            
        
          | 25 | 
           | 
          26 | 
           | 
        
        
          | 26 | 
          BEGIN { | 
          27 | 
          BEGIN { | 
        
        
          | 27 | 
              use_ok('Koha::Objects'); | 
          28 | 
              use_ok('Koha::Objects'); | 
        
  
    | 
      
            Lines 57-73
          my $b2 = Koha::Patron->new(
      
      
        Link Here
      
     | 
  
        
          | 57 | 
              }  | 
          58 | 
              }  | 
        
        
          | 58 | 
          );  | 
          59 | 
          );  | 
        
        
          | 59 | 
          $b2->store();  | 
          60 | 
          $b2->store();  | 
        
            
               | 
               | 
              61 | 
              my $three_days_ago = dt_from_string->add( days => -3 );  | 
            
        
          | 60 | 
          my $b3 = Koha::Patron->new(  | 
          62 | 
          my $b3 = Koha::Patron->new(  | 
        
        
          | 61 | 
              { | 
          63 | 
              { | 
        
        
          | 62 | 
                  surname      => 'Test 3',  | 
          64 | 
                  surname      => 'Test 3',  | 
        
        
          | 63 | 
                  branchcode   => $branchcode,  | 
          65 | 
                  branchcode   => $branchcode,  | 
        
          
            
              | 64 | 
                      categorycode => $categorycode  | 
              66 | 
                      categorycode => $categorycode,  | 
            
            
               | 
               | 
              67 | 
                      updated_on   => $three_days_ago,  | 
            
        
          | 65 | 
              }  | 
          68 | 
              }  | 
        
        
          | 66 | 
          );  | 
          69 | 
          );  | 
        
        
          | 67 | 
          $b3->store();  | 
          70 | 
          $b3->store();  | 
        
        
          | 68 | 
           | 
          71 | 
           | 
        
        
          | 69 | 
          my $b1_new = Koha::Patrons->find( $b1->borrowernumber() );  | 
          72 | 
          my $b1_new = Koha::Patrons->find( $b1->borrowernumber() );  | 
        
        
          | 70 | 
          is( $b1->surname(), $b1_new->surname(), "Found matching patron" );  | 
          73 | 
          is( $b1->surname(), $b1_new->surname(), "Found matching patron" );  | 
        
            
               | 
               | 
              74 | 
              isnt( $b1_new->updated_on, undef, "borrowers.updated_on should be set" );  | 
            
            
              | 75 | 
              is( dt_from_string($b1_new->updated_on), dt_from_string, "borrowers.updated_on should have been set to now on creating" );  | 
            
            
              | 76 | 
               | 
            
            
              | 77 | 
              my $b3_new = Koha::Patrons->find( $b3->borrowernumber() );  | 
            
            
              | 78 | 
              is( dt_from_string($b3_new->updated_on), $three_days_ago, "borrowers.updated_on should have been kept to what we set on creating" );  | 
            
            
              | 79 | 
              $b3_new->set({ surname => 'another surname for Test 3' }); | 
            
            
              | 80 | 
              $b3_new = Koha::Patrons->find( $b3->borrowernumber() );  | 
            
            
              | 81 | 
              is( dt_from_string($b1_new->updated_on), dt_from_string, "borrowers.updated_on should have been set to now on updating" );  | 
            
        
          | 71 | 
           | 
          82 | 
           | 
        
        
          | 72 | 
          my @patrons = Koha::Patrons->search( { branchcode => $branchcode } ); | 
          83 | 
          my @patrons = Koha::Patrons->search( { branchcode => $branchcode } ); | 
        
        
          | 73 | 
          is( @patrons, 3, "Found 3 patrons with Search" );  | 
          84 | 
          is( @patrons, 3, "Found 3 patrons with Search" );  | 
        
            
              | 74 | 
              -   | 
               | 
               |