| Lines 20-26
          
      
      
        Link Here | 
        
          | 20 | use Modern::Perl; | 20 | use Modern::Perl; | 
        
          | 21 |  | 21 |  | 
        
          | 22 | use Test::NoWarnings; | 22 | use Test::NoWarnings; | 
          
            
              | 23 | use Test::More tests => 21; | 23 | use Test::More tests => 22; | 
        
          | 24 |  | 24 |  | 
        
          | 25 | use Test::MockModule; | 25 | use Test::MockModule; | 
        
          | 26 | use Test::Exception; | 26 | use Test::Exception; | 
  
    | Lines 2456-2458
          subtest 'filter_by_checked_out' => sub {
      
      
        Link Here | 
        
          | 2456 |     $schema->storage->txn_rollback; | 2456 |     $schema->storage->txn_rollback; | 
        
          | 2457 |  | 2457 |  | 
        
          | 2458 | }; | 2458 | }; | 
          
            
              | 2459 | -  | 2459 |  | 
            
              |  |  | 2460 | subtest 'filter_by_in_transit' => sub { | 
            
              | 2461 |     plan tests => 3; | 
            
              | 2462 |  | 
            
              | 2463 |     $schema->storage->txn_begin; | 
            
              | 2464 |  | 
            
              | 2465 |     my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); | 
            
              | 2466 |     t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); | 
            
              | 2467 |  | 
            
              | 2468 |     my $library_1 = $builder->build( { source => 'Branch' } ); | 
            
              | 2469 |     my $library_2 = $builder->build( { source => 'Branch' } ); | 
            
              | 2470 |  | 
            
              | 2471 |     my $biblio = $builder->build_sample_biblio(); | 
            
              | 2472 |     my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } ); | 
            
              | 2473 |     my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } ); | 
            
              | 2474 |  | 
            
              | 2475 |     is( $biblio->items->filter_by_in_transit->count, 0, "Filtered 0 in transit items" ); | 
            
              | 2476 |  | 
            
              | 2477 |     my $transfer_1 = $builder->build_object( | 
            
              | 2478 |         { | 
            
              | 2479 |             class => 'Koha::Item::Transfers', | 
            
              | 2480 |             value => { | 
            
              | 2481 |                 itemnumber => $item_1->itemnumber, | 
            
              | 2482 |                 frombranch => $library_1->{branchcode}, | 
            
              | 2483 |                 tobranch   => $library_2->{branchcode}, | 
            
              | 2484 |             } | 
            
              | 2485 |         } | 
            
              | 2486 |     ); | 
            
              | 2487 |  | 
            
              | 2488 |     is( $biblio->items->filter_by_in_transit->count, 1, "Filtered 1 in transit items" ); | 
            
              | 2489 |  | 
            
              | 2490 |     my $transfer_2 = $builder->build_object( | 
            
              | 2491 |         { | 
            
              | 2492 |             class => 'Koha::Item::Transfers', | 
            
              | 2493 |             value => { | 
            
              | 2494 |                 itemnumber => $item_2->itemnumber, | 
            
              | 2495 |                 frombranch => $library_2->{branchcode}, | 
            
              | 2496 |                 tobranch   => $library_1->{branchcode}, | 
            
              | 2497 |             } | 
            
              | 2498 |         } | 
            
              | 2499 |     ); | 
            
              | 2500 |  | 
            
              | 2501 |     is( $biblio->items->filter_by_in_transit->count, 2, "Filtered 2 in transit items" ); | 
            
              | 2502 |  | 
            
              | 2503 |     $schema->storage->txn_rollback; | 
            
              | 2504 |  | 
            
              | 2505 | }; |