| 
      
            Lines 20-25
          
      
      
        Link Here
      
     | 
  
        
          | 20 | 
          use Modern::Perl;  | 
          20 | 
          use Modern::Perl;  | 
        
        
          | 21 | 
           | 
          21 | 
           | 
        
        
          | 22 | 
          use Test::More tests => 9;  | 
          22 | 
          use Test::More tests => 9;  | 
        
            
               | 
               | 
              23 | 
              use Test::Exception;  | 
            
        
          | 23 | 
           | 
          24 | 
           | 
        
        
          | 24 | 
          use C4::Circulation;  | 
          25 | 
          use C4::Circulation;  | 
        
        
          | 25 | 
          use Koha::Item;  | 
          26 | 
          use Koha::Item;  | 
        
  
    | 
      
            Lines 156-169
          subtest 'can_be_transferred' => sub {
      
      
        Link Here
      
     | 
  
        
          | 156 | 
              })->count, 1, 'Given we have added a transfer limit,');  | 
          157 | 
              })->count, 1, 'Given we have added a transfer limit,');  | 
        
        
          | 157 | 
              is($item->can_be_transferred({ to => $library2 }), 0, | 
          158 | 
              is($item->can_be_transferred({ to => $library2 }), 0, | 
        
        
          | 158 | 
                 'Item can no longer be transferred between libraries.');  | 
          159 | 
                 'Item can no longer be transferred between libraries.');  | 
        
          
            
              | 159 | 
                  is($item->can_be_transferred({ to => $library2, $library1 }), 0, | 
              160 | 
                  is($item->can_be_transferred({ to => $library2, from => $library1 }), 0, | 
            
        
          | 160 | 
                 'We get the same result also if we pass the from-library parameter.');  | 
          161 | 
                 'We get the same result also if we pass the from-library parameter.');  | 
        
          
            
              | 161 | 
                  eval { $item->can_be_transferred({ to => undef }); }; | 
              162 | 
                  throws_ok { $item->can_be_transferred({ to => undef }); } | 
            
            
              | 162 | 
                  is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.');  | 
              163 | 
                            'Koha::Exceptions::Library::NotFound',  | 
            
            
              | 163 | 
                  eval { $item->can_be_transferred({ to => 'heaven' }); }; | 
              164 | 
                            'Exception thrown when no library given.';  | 
            
            
              | 164 | 
                  is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.');  | 
              165 | 
                  throws_ok { $item->can_be_transferred({ to => 'heaven' }); } | 
            
            
              | 165 | 
                  eval { $item->can_be_transferred({ to => $library2, from => 'hell' }); }; | 
              166 | 
                            'Koha::Exceptions::Library::NotFound',  | 
            
            
              | 166 | 
                  is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.');  | 
              167 | 
                            'Exception thrown when invalid library is given.';  | 
            
            
               | 
               | 
              168 | 
                  throws_ok { $item->can_be_transferred({ to => $library2, from => 'hell' }); } | 
            
            
              | 169 | 
                            'Koha::Exceptions::Library::NotFound',  | 
            
            
              | 170 | 
                            'Exception thrown when invalid library is given.';  | 
            
        
          | 167 | 
          };  | 
          171 | 
          };  | 
        
        
          | 168 | 
           | 
          172 | 
           | 
        
        
          | 169 | 
          $retrieved_item_1->delete;  | 
          173 | 
          $retrieved_item_1->delete;  | 
        
            
              | 170 | 
              -   | 
               | 
               |