| 
      
            Lines 351-357
          subtest 'Default values' => sub {
      
      
        Link Here
      
     | 
  
        
          | 351 | 
           | 
          351 | 
           | 
        
        
          | 352 | 
          subtest 'build_object() tests' => sub { | 
          352 | 
          subtest 'build_object() tests' => sub { | 
        
        
          | 353 | 
           | 
          353 | 
           | 
        
          
            
              | 354 | 
                  plan tests => 6;  | 
              354 | 
                  plan tests => 5;  | 
            
        
          | 355 | 
           | 
          355 | 
           | 
        
        
          | 356 | 
              $builder = t::lib::TestBuilder->new();  | 
          356 | 
              $builder = t::lib::TestBuilder->new();  | 
        
        
          | 357 | 
           | 
          357 | 
           | 
        
  
    | 
      
            Lines 372-383
          subtest 'build_object() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 372 | 
                  $categorycode, 'Category code correctly set' );  | 
          372 | 
                  $categorycode, 'Category code correctly set' );  | 
        
        
          | 373 | 
              is( $issuing_rule->itemtype, $itemtype, 'Item type correctly set' );  | 
          373 | 
              is( $issuing_rule->itemtype, $itemtype, 'Item type correctly set' );  | 
        
        
          | 374 | 
           | 
          374 | 
           | 
        
            
              | 375 | 
                  warning_is { $issuing_rule = $builder->build_object( {} ); } | 
               | 
               | 
            
            
              | 376 | 
                  { carped => 'Missing class param' }, | 
            
            
              | 377 | 
                      'The class parameter is mandatory, raises a warning if absent';  | 
            
            
              | 378 | 
                  is( $issuing_rule, undef,  | 
            
            
              | 379 | 
                      'If the class parameter is missing, undef is returned' );  | 
            
            
              | 380 | 
               | 
            
        
          | 381 | 
              subtest 'Test all classes' => sub { | 
          375 | 
              subtest 'Test all classes' => sub { | 
        
        
          | 382 | 
                  my $Koha_modules_dir = dirname(__FILE__) . '/../../Koha';  | 
          376 | 
                  my $Koha_modules_dir = dirname(__FILE__) . '/../../Koha';  | 
        
        
          | 383 | 
                  my @koha_object_based_modules = `/bin/grep -rl -e '^sub object_class' $Koha_modules_dir`;  | 
          377 | 
                  my @koha_object_based_modules = `/bin/grep -rl -e '^sub object_class' $Koha_modules_dir`;  | 
        
  
    | 
      
            Lines 394-403
          subtest 'build_object() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 394 | 
                      is( ref($object), $module->object_class, "Testing $module" );  | 
          388 | 
                      is( ref($object), $module->object_class, "Testing $module" );  | 
        
        
          | 395 | 
                  }  | 
          389 | 
                  }  | 
        
        
          | 396 | 
              };  | 
          390 | 
              };  | 
        
            
               | 
               | 
              391 | 
               | 
            
            
              | 392 | 
                  subtest 'test parameters' => sub { | 
            
            
              | 393 | 
                      plan tests => 3;  | 
            
            
              | 394 | 
               | 
            
            
              | 395 | 
                      warning_is { $issuing_rule = $builder->build_object( {} ); } | 
            
            
              | 396 | 
                      { carped => 'Missing class param' }, | 
            
            
              | 397 | 
                          'The class parameter is mandatory, raises a warning if absent';  | 
            
            
              | 398 | 
                      is( $issuing_rule, undef,  | 
            
            
              | 399 | 
                          'If the class parameter is missing, undef is returned' );  | 
            
            
              | 400 | 
               | 
            
            
              | 401 | 
                      warnings_like { | 
            
            
              | 402 | 
                          $builder->build_object(  | 
            
            
              | 403 | 
                              { class => 'Koha::Patrons', categorycode => 'foobar' } ); | 
            
            
              | 404 | 
                      } qr{Unknown parameter\(s\): categorycode}, ""; | 
            
            
              | 405 | 
                  };  | 
            
        
          | 397 | 
          };  | 
          406 | 
          };  | 
        
        
          | 398 | 
           | 
          407 | 
           | 
        
        
          | 399 | 
          subtest '->build parameter' => sub { | 
          408 | 
          subtest '->build parameter' => sub { | 
        
          
            
              | 400 | 
                  plan tests => 3;  | 
              409 | 
                  plan tests => 4;  | 
            
        
          | 401 | 
           | 
          410 | 
           | 
        
        
          | 402 | 
              # Test to make sure build() warns user of unknown parameters.  | 
          411 | 
              # Test to make sure build() warns user of unknown parameters.  | 
        
        
          | 403 | 
              warnings_are { | 
          412 | 
              warnings_are { | 
        
  
    | 
      
            Lines 421-426
          subtest '->build parameter' => sub {
      
      
        Link Here
      
     | 
  
        
          | 421 | 
                      zource     => 'Branch', # Intentional spelling error  | 
          430 | 
                      zource     => 'Branch', # Intentional spelling error  | 
        
        
          | 422 | 
                  })  | 
          431 | 
                  })  | 
        
        
          | 423 | 
              } qr/Source parameter not specified/, "Catch warning on missing source";  | 
          432 | 
              } qr/Source parameter not specified/, "Catch warning on missing source";  | 
        
            
               | 
               | 
              433 | 
               | 
            
            
              | 434 | 
                  warnings_like { | 
            
            
              | 435 | 
                      $builder->build(  | 
            
            
              | 436 | 
                          { source => 'Borrower', categorycode => 'foobar' } ); | 
            
            
              | 437 | 
                  } qr{Unknown parameter\(s\): categorycode}, ""; | 
            
        
          | 424 | 
          };  | 
          438 | 
          };  | 
        
        
          | 425 | 
           | 
          439 | 
           | 
        
        
          | 426 | 
          $schema->storage->txn_rollback;  | 
          440 | 
          $schema->storage->txn_rollback;  |