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

(-)a/t/db_dependent/Items/GetItemsForInventory.t (-6 / +9 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Test::More tests => 7;
22
use Test::More tests => 7;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
24
25
use List::MoreUtils qw( any none );
26
25
use C4::Biblio qw(AddBiblio);
27
use C4::Biblio qw(AddBiblio);
26
use C4::Reserves;
28
use C4::Reserves;
27
use Koha::AuthorisedValues;
29
use Koha::AuthorisedValues;
Lines 59-65 subtest 'Old version is unchanged' => sub { Link Here
59
61
60
subtest 'Skip items with waiting holds' => sub {
62
subtest 'Skip items with waiting holds' => sub {
61
63
62
    plan tests => 5;
64
    plan tests => 6;
63
65
64
    $schema->storage->txn_begin;
66
    $schema->storage->txn_begin;
65
67
Lines 69-76 subtest 'Skip items with waiting holds' => sub { Link Here
69
    my $patron = $builder->build_object(
71
    my $patron = $builder->build_object(
70
        { class => 'Koha::Patrons', value => { branchcode => $library->id } } );
72
        { class => 'Koha::Patrons', value => { branchcode => $library->id } } );
71
73
72
    my $title_1 = 'Title 1';
74
    my $title_1 = 'Title 1, ';
73
    my $title_2 = 'Title 2';
75
    my $title_2 = 'Title 2, bizzarre one so doesn\'t already exist';
74
76
75
    my $biblio_1 = create_helper_biblio( $itemtype->itemtype, $title_1 );
77
    my $biblio_1 = create_helper_biblio( $itemtype->itemtype, $title_1 );
76
    my $biblio_2 = create_helper_biblio( $itemtype->itemtype, $title_2 );
78
    my $biblio_2 = create_helper_biblio( $itemtype->itemtype, $title_2 );
Lines 117-124 subtest 'Skip items with waiting holds' => sub { Link Here
117
119
118
    my ( $new_items, $new_items_count ) = GetItemsForInventory( { ignore_waiting_holds => 1 } );
120
    my ( $new_items, $new_items_count ) = GetItemsForInventory( { ignore_waiting_holds => 1 } );
119
    is( $new_items_count, $first_items_count + 1, 'Item on hold skipped, count makes sense' );
121
    is( $new_items_count, $first_items_count + 1, 'Item on hold skipped, count makes sense' );
120
    is( $new_items->[ scalar @{$new_items} - 1 ]->{title},
122
    ok( (any { $_->{title} eq $title_2 } @{$new_items}),
121
        $title_2, 'Item on hold skipped, last item is the correct one' );
123
        'Item on hold skipped, the other one we added is present' );
124
    ok( (none { $_->{title} eq $title_1 } @{$new_items}),
125
        'Item on hold skipped, no one matches' );
122
126
123
    $schema->storage->txn_rollback;
127
    $schema->storage->txn_rollback;
124
};
128
};
125
- 

Return to bug 21413