| 
      
            Lines 290-296
          subtest 'list_rules() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 290 | 
          };  | 
          290 | 
          };  | 
        
        
          | 291 | 
           | 
          291 | 
           | 
        
        
          | 292 | 
          subtest 'set_rules() tests' => sub { | 
          292 | 
          subtest 'set_rules() tests' => sub { | 
        
          
            
              | 293 | 
                  plan tests => 23;  | 
              293 | 
                  plan tests => 28;  | 
            
        
          | 294 | 
           | 
          294 | 
           | 
        
        
          | 295 | 
              $schema->storage->txn_begin;  | 
          295 | 
              $schema->storage->txn_begin;  | 
        
        
          | 296 | 
           | 
          296 | 
           | 
        
  
    | 
      
            Lines 388-392
          subtest 'set_rules() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 388 | 
              is( $json->{fine},     10, "Fine rule set correctly for wildcard context" ); | 
          388 | 
              is( $json->{fine},     10, "Fine rule set correctly for wildcard context" ); | 
        
        
          | 389 | 
              is( $json->{finedays}, 7,  "Finedays rule set correctly for wildcard context" ); | 
          389 | 
              is( $json->{finedays}, 7,  "Finedays rule set correctly for wildcard context" ); | 
        
        
          | 390 | 
           | 
          390 | 
           | 
        
            
               | 
               | 
              391 | 
                  # Setting rules empty and undefined  | 
            
            
              | 392 | 
                  note("Setting rules to empty and undefined"); | 
            
            
              | 393 | 
                  $rules_to_set->{fine}     = ''; | 
            
            
              | 394 | 
                  $rules_to_set->{finedays} = undef; | 
            
            
              | 395 | 
                  $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set )->status_is(200);  | 
            
            
              | 396 | 
               | 
            
            
              | 397 | 
                  # Verify the rules were updated  | 
            
            
              | 398 | 
                  $json = $t->tx->res->json;  | 
            
            
              | 399 | 
                  is( $json->{fine},     '',    "Fine rule updated correctly" ); | 
            
            
              | 400 | 
                  is( $json->{finedays}, undef, "Finedays rule remains the same" ); | 
            
            
              | 401 | 
               | 
            
            
              | 402 | 
                  # Verify that the explicit undef results in a rule deletion  | 
            
            
              | 403 | 
                  my $rules = Koha::CirculationRules->search(  | 
            
            
              | 404 | 
                      { categorycode => undef, branchcode => undef, itemtype => undef, rule_name => 'finedays' } ); | 
            
            
              | 405 | 
                  is( $rules->count, 0, "Finedays rule deleted from database" );  | 
            
            
              | 406 | 
               | 
            
        
          | 391 | 
              $schema->storage->txn_rollback;  | 
          407 | 
              $schema->storage->txn_rollback;  | 
        
        
          | 392 | 
          };  | 
          408 | 
          };  | 
        
            
              | 393 | 
              -   | 
               | 
               |