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

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

Return to bug 37334