Bug 25297: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2020-04-27 18:55:32 -03:00 committed by Martin Renvoize
parent 6ccad9a14a
commit e3382d89cd
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 11 additions and 4 deletions

View File

@ -285,7 +285,7 @@ subtest 'duplicate_to | add_item' => sub {
subtest 'current_item_level_holds() tests' => sub {
plan tests => 3;
plan tests => 5;
$schema->storage->txn_begin;
@ -334,16 +334,23 @@ subtest 'current_item_level_holds() tests' => sub {
}
);
is( $order->current_item_level_holds, undef, 'Returns undef if no linked biblio');
my $holds = $order->current_item_level_holds;
is( ref($holds), 'Koha::Holds', 'Koha::Holds iterator returned if no linked biblio' );
is( $holds->count, 0, 'Count is 0 if no linked biblio' );
$order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes;
is( $order->current_item_level_holds, undef, 'Returns undef if no linked items');
$holds = $order->current_item_level_holds;
is( ref($holds), 'Koha::Holds', 'Koha::Holds iterator returned if no linked items' );
is( $holds->count, 0, 'Count is 0 if no linked items' );
$order->add_item( $item_2->itemnumber );
$order->add_item( $item_3->itemnumber );
is( $order->current_item_level_holds->count, 1, 'Only current (not future) holds are returned');
$holds = $order->current_item_level_holds;
is( $holds->count, 1, 'Only current (not future) holds are returned');
$schema->storage->txn_rollback;
};