| Lines 19-25
          
      
      
        Link Here | 
        
          | 19 |  | 19 |  | 
        
          | 20 | use Modern::Perl; | 20 | use Modern::Perl; | 
        
          | 21 |  | 21 |  | 
          
            
              | 22 | use Test::More tests => 20; | 22 | use Test::More tests => 21; | 
        
          | 23 |  | 23 |  | 
        
          | 24 | use Test::MockModule; | 24 | use Test::MockModule; | 
        
          | 25 | use Test::Exception; | 25 | use Test::Exception; | 
  
    | Lines 2423-2425
          subtest 'filter_by_bookable' => sub {
      
      
        Link Here | 
        
          | 2423 |  | 2423 |  | 
        
          | 2424 |     $schema->storage->txn_rollback; | 2424 |     $schema->storage->txn_rollback; | 
        
          | 2425 | }; | 2425 | }; | 
          
            
              | 2426 | -  | 2426 |  | 
            
              |  |  | 2427 | subtest 'filter_by_checked_out' => sub { | 
            
              | 2428 |     plan tests => 4; | 
            
              | 2429 |  | 
            
              | 2430 |     $schema->storage->txn_begin; | 
            
              | 2431 |  | 
            
              | 2432 |     my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); | 
            
              | 2433 |     t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); | 
            
              | 2434 |  | 
            
              | 2435 |     my $biblio = $builder->build_sample_biblio(); | 
            
              | 2436 |     my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } ); | 
            
              | 2437 |     my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } ); | 
            
              | 2438 |  | 
            
              | 2439 |     is( $biblio->items->filter_by_checked_out->count, 0, "Filtered 0 checked out items" ); | 
            
              | 2440 |  | 
            
              | 2441 |     C4::Circulation::AddIssue( $patron, $item_1->barcode ); | 
            
              | 2442 |  | 
            
              | 2443 |     is( $biblio->items->filter_by_checked_out->count, 1, "Filtered 1 checked out items" ); | 
            
              | 2444 |  | 
            
              | 2445 |     C4::Circulation::AddIssue( $patron, $item_2->barcode ); | 
            
              | 2446 |  | 
            
              | 2447 |     is( $biblio->items->filter_by_checked_out->count, 2, "Filtered 2 checked out items" ); | 
            
              | 2448 |  | 
            
              | 2449 |     # Do the returns | 
            
              | 2450 |     C4::Circulation::AddReturn( $item_1->barcode ); | 
            
              | 2451 |     C4::Circulation::AddReturn( $item_2->barcode ); | 
            
              | 2452 |  | 
            
              | 2453 |     is( $biblio->items->filter_by_checked_out->count, 0, "Filtered 0 checked out items" ); | 
            
              | 2454 |  | 
            
              | 2455 |     $schema->storage->txn_rollback; | 
            
              | 2456 |  | 
            
              | 2457 | }; |