| 
      
            Lines 17-22
          
      
      
        Link Here
      
     | 
  
        
          | 17 | 
          use Modern::Perl;  | 
          17 | 
          use Modern::Perl;  | 
        
        
          | 18 | 
           | 
          18 | 
           | 
        
        
          | 19 | 
          use Test::More tests => 4;  | 
          19 | 
          use Test::More tests => 4;  | 
        
            
               | 
               | 
              20 | 
              use Test::MockModule;  | 
            
        
          | 20 | 
          use Test::Warn;  | 
          21 | 
          use Test::Warn;  | 
        
        
          | 21 | 
           | 
          22 | 
           | 
        
        
          | 22 | 
          use File::Basename;  | 
          23 | 
          use File::Basename;  | 
        
  
    | 
      
            Lines 43-49
          t::lib::Mocks::mock_config( 'enable_plugins', 1 );
      
      
        Link Here
      
     | 
  
        
          | 43 | 
           | 
          44 | 
           | 
        
        
          | 44 | 
          subtest 'post_renewal_action() hook tests' => sub { | 
          45 | 
          subtest 'post_renewal_action() hook tests' => sub { | 
        
        
          | 45 | 
           | 
          46 | 
           | 
        
          
            
              | 46 | 
                  plan tests => 4;  | 
              47 | 
                  plan tests => 1;  | 
            
        
          | 47 | 
           | 
          48 | 
           | 
        
        
          | 48 | 
              $schema->storage->txn_begin;  | 
          49 | 
              $schema->storage->txn_begin;  | 
        
        
          | 49 | 
           | 
          50 | 
           | 
        
  
    | 
      
            Lines 61-83
          subtest 'post_renewal_action() hook tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 61 | 
                  }  | 
          62 | 
                  }  | 
        
        
          | 62 | 
              );  | 
          63 | 
              );  | 
        
        
          | 63 | 
           | 
          64 | 
           | 
        
          
            
              | 64 | 
                  my ($biblio, $item);  | 
              65 | 
                  # Avoid testing useless warnings  | 
            
            
               | 
               | 
              66 | 
                  my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); | 
            
            
              | 67 | 
                  $test_plugin->mock( 'after_item_action', undef );  | 
            
            
              | 68 | 
                  $test_plugin->mock( 'after_biblio_action', undef );  | 
            
        
          | 65 | 
           | 
          69 | 
           | 
        
          
            
              | 66 | 
                  warning_like { $biblio = $builder->build_sample_biblio(); } | 
              70 | 
                  my $biblio = $builder->build_sample_biblio();  | 
            
            
              | 67 | 
                          qr/after_biblio_action called with action: create, ref: Koha::Biblio/,  | 
              71 | 
                  my $item   = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); | 
            
            
              | 68 | 
                          'AddBiblio calls the hook with action=create';  | 
              72 | 
                  AddIssue( $patron->unblessed, $item->barcode );  | 
            
        
          | 69 | 
           | 
          73 | 
           | 
        
          
            
              | 70 | 
                  warning_like { $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); } | 
              74 | 
                  warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); } | 
            
            
              | 71 | 
                          qr/after_item_action called with action: create, ref: Koha::Item/,  | 
              75 | 
                          qr/after_circ_action called with action: renewal, ref: DateTime/,  | 
            
            
              | 72 | 
                          'AddItem calls the hook with action=create';  | 
               | 
               | 
            
            
              | 73 | 
               | 
            
            
              | 74 | 
                  warning_like { AddIssue( $patron->unblessed, $item->barcode ); } | 
            
            
              | 75 | 
                          qr/after_item_action called with action: modify, ref: Koha::Item/,  | 
            
            
              | 76 | 
                          'AddItem calls the hook with action=modify';  | 
            
            
              | 77 | 
               | 
            
            
              | 78 | 
                  warnings_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); } | 
            
            
              | 79 | 
                          [ qr/after_item_action called with action: modify, ref: Koha::Item/,  | 
            
            
              | 80 | 
                            qr/post_renewal_action .* DateTime/ ],  | 
            
        
          | 81 | 
                      'AddRenewal calls the post_renewal_action hook';  | 
          76 | 
                      'AddRenewal calls the post_renewal_action hook';  | 
        
        
          | 82 | 
           | 
          77 | 
           | 
        
        
          | 83 | 
              $schema->storage->txn_rollback;  | 
          78 | 
              $schema->storage->txn_rollback;  |