| Lines 19-25
          
      
      
        Link Here | 
        
          | 19 |  | 19 |  | 
        
          | 20 | use Modern::Perl; | 20 | use Modern::Perl; | 
        
          | 21 |  | 21 |  | 
          
            
              | 22 | use Test::More tests => 23; | 22 | use Test::More tests => 24; | 
        
          | 23 |  | 23 |  | 
        
          | 24 | use Test::MockModule; | 24 | use Test::MockModule; | 
        
          | 25 | use Test::Exception; | 25 | use Test::Exception; | 
  
    | Lines 2345-2347
          subtest 'filter_by_has_holds' => sub {
      
      
        Link Here | 
        
          | 2345 |     $schema->storage->txn_rollback; | 2345 |     $schema->storage->txn_rollback; | 
        
          | 2346 |  | 2346 |  | 
        
          | 2347 | }; | 2347 | }; | 
          
            
              | 2348 | -  | 2348 |  | 
            
              |  |  | 2349 | subtest 'filter_by_in_bundle' => sub { | 
            
              | 2350 |     plan tests => 3; | 
            
              | 2351 |  | 
            
              | 2352 |     $schema->storage->txn_begin; | 
            
              | 2353 |  | 
            
              | 2354 |     my $library = $builder->build( { source => 'Branch' } ); | 
            
              | 2355 |     my $biblio = $builder->build_sample_biblio(); | 
            
              | 2356 |  | 
            
              | 2357 |     my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, }); | 
            
              | 2358 |     my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, }); | 
            
              | 2359 |     my $item_3 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, }); | 
            
              | 2360 |  | 
            
              | 2361 |     is ( $biblio->items->filter_by_in_bundle->count, 0, "0 items in a bundle for this record" ); | 
            
              | 2362 |  | 
            
              | 2363 |     my $in_bundle = $item_1->in_bundle; | 
            
              | 2364 |  | 
            
              | 2365 |  | 
            
              | 2366 |     my $host_item = $builder->build_sample_item(); | 
            
              | 2367 |     $schema->resultset('ItemBundle') | 
            
              | 2368 |       ->create( { host => $host_item->itemnumber, item => $item_1->itemnumber } ); | 
            
              | 2369 |  | 
            
              | 2370 |     $in_bundle = $item_1->in_bundle; | 
            
              | 2371 |  | 
            
              | 2372 |     is ( $biblio->items->filter_by_in_bundle->count, 1, "1 item in a bundle for this record" ); | 
            
              | 2373 |     $schema->resultset('ItemBundle') | 
            
              | 2374 |       ->create( { host => $host_item->itemnumber, item => $item_2->itemnumber } ); | 
            
              | 2375 |  | 
            
              | 2376 |     $in_bundle = $item_2->in_bundle; | 
            
              | 2377 |  | 
            
              | 2378 |     is ( $biblio->items->filter_by_in_bundle->count, 2, "2 items in a bundle for this record" ); | 
            
              | 2379 |  | 
            
              | 2380 |     $schema->storage->txn_rollback; | 
            
              | 2381 |  | 
            
              | 2382 | }; |