View | Details | Raw Unified | Return to bug 37334
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Items.t (-2 / +33 lines)
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 2546-2548 subtest 'filter_by_has_holds' => sub { Link Here
2546
    $schema->storage->txn_rollback;
2546
    $schema->storage->txn_rollback;
2547
2547
2548
};
2548
};
2549
- 
2549
2550
subtest 'filter_by_in_bundle' => sub {
2551
    plan tests => 3;
2552
2553
    $schema->storage->txn_begin;
2554
2555
    my $library = $builder->build( { source => 'Branch' } );
2556
    my $biblio  = $builder->build_sample_biblio();
2557
2558
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } );
2559
    my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } );
2560
    my $item_3 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, } );
2561
2562
    is( $biblio->items->filter_by_in_bundle->count, 0, "0 items in a bundle for this record" );
2563
2564
    my $in_bundle = $item_1->in_bundle;
2565
2566
    my $host_item = $builder->build_sample_item();
2567
    $schema->resultset('ItemBundle')->create( { host => $host_item->itemnumber, item => $item_1->itemnumber } );
2568
2569
    $in_bundle = $item_1->in_bundle;
2570
2571
    is( $biblio->items->filter_by_in_bundle->count, 1, "1 item in a bundle for this record" );
2572
    $schema->resultset('ItemBundle')->create( { host => $host_item->itemnumber, item => $item_2->itemnumber } );
2573
2574
    $in_bundle = $item_2->in_bundle;
2575
2576
    is( $biblio->items->filter_by_in_bundle->count, 2, "2 items in a bundle for this record" );
2577
2578
    $schema->storage->txn_rollback;
2579
2580
};

Return to bug 37334