| 
      
            Lines 39-48
          my $builder = t::lib::TestBuilder->new;
      
      
        Link Here
      
     | 
  
        
          | 39 | 
           | 
          39 | 
           | 
        
        
          | 40 | 
          subtest 'exception_holidays() tests' => sub { | 
          40 | 
          subtest 'exception_holidays() tests' => sub { | 
        
        
          | 41 | 
           | 
          41 | 
           | 
        
          
            
              | 42 | 
                  plan tests => 1;  | 
              42 | 
                  plan tests => 2;  | 
            
        
          | 43 | 
           | 
          43 | 
           | 
        
        
          | 44 | 
              $schema->storage->txn_begin;  | 
          44 | 
              $schema->storage->txn_begin;  | 
        
        
          | 45 | 
           | 
          45 | 
           | 
        
            
               | 
               | 
              46 | 
                  my $branch = $builder->build( { source => 'Branch' } )->{branchcode}; | 
            
            
              | 47 | 
                  my $branch2 = $builder->build( { source => 'Branch' } )->{branchcode}; | 
            
            
              | 48 | 
               | 
            
            
              | 49 | 
                  $dbh->do("DELETE FROM special_holidays"); | 
            
            
              | 50 | 
                  # Clear cache  | 
            
            
              | 51 | 
                  Koha::Caches->get_instance->flush_all;  | 
            
            
              | 52 | 
               | 
            
            
              | 53 | 
                  my $holiday2add = dt_from_string("2030-07-07"); | 
            
            
              | 54 | 
                  C4::Calendar->new( branchcode => $branch )->insert_day_month_holiday(  | 
            
            
              | 55 | 
                      day         => $holiday2add->day(),  | 
            
            
              | 56 | 
                      month       => $holiday2add->month(),  | 
            
            
              | 57 | 
                      year        => $holiday2add->year(),  | 
            
            
              | 58 | 
                      title       => 'A holiday',  | 
            
            
              | 59 | 
                      description => "This is a holiday, for now",  | 
            
            
              | 60 | 
                  );  | 
            
            
              | 61 | 
               | 
            
            
              | 62 | 
                  C4::Calendar->new( branchcode => $branch )->insert_exception_holiday(  | 
            
            
              | 63 | 
                      day         => 7,  | 
            
            
              | 64 | 
                      month       => 7,  | 
            
            
              | 65 | 
                      year        => 2020,  | 
            
            
              | 66 | 
                      title       => 'Not a holiday',  | 
            
            
              | 67 | 
                      description => 'This date should not be a holiday',  | 
            
            
              | 68 | 
                  );  | 
            
            
              | 69 | 
               | 
            
            
              | 70 | 
                  my $calendar = Koha::Calendar->new( branchcode => $branch2 );  | 
            
            
              | 71 | 
                  $calendar->exception_holidays(); #This sets exception holiday in cache  | 
            
            
              | 72 | 
                  $calendar = Koha::Calendar->new( branchcode => $branch );  | 
            
            
              | 73 | 
                  is( $calendar->is_holiday( dt_from_string('2020-07-07') ), 0, "The date is not a holiday"); | 
            
            
              | 74 | 
               | 
            
        
          | 46 | 
              $dbh->do("DELETE FROM special_holidays"); | 
          75 | 
              $dbh->do("DELETE FROM special_holidays"); | 
        
        
          | 47 | 
              # Clear cache  | 
          76 | 
              # Clear cache  | 
        
        
          | 48 | 
              Koha::Caches->get_instance->flush_all;  | 
          77 | 
              Koha::Caches->get_instance->flush_all;  | 
        
  
    | 
      
            Lines 53-60
          subtest 'exception_holidays() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 53 | 
              use POSIX qw(tzset);  | 
          82 | 
              use POSIX qw(tzset);  | 
        
        
          | 54 | 
              tzset;  | 
          83 | 
              tzset;  | 
        
        
          | 55 | 
           | 
          84 | 
           | 
        
          
            
              | 56 | 
                  my $branch = $builder->build( { source => 'Branch' } )->{branchcode}; | 
              85 | 
                  $calendar = Koha::Calendar->new( branchcode => $branch );  | 
            
            
              | 57 | 
                  my $calendar = Koha::Calendar->new( branchcode => $branch );  | 
               | 
               | 
            
        
          | 58 | 
           | 
          86 | 
           | 
        
        
          | 59 | 
              C4::Calendar->new( branchcode => $branch )->insert_exception_holiday(  | 
          87 | 
              C4::Calendar->new( branchcode => $branch )->insert_exception_holiday(  | 
        
        
          | 60 | 
                  day         => 6,  | 
          88 | 
                  day         => 6,  | 
        
            
              | 61 | 
              -   | 
               | 
               |