Bug 41954: Update existing tests
The logical behavior is different. Hold groups are now meant to be kept for historical reasons Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
b0bb216310
commit
fd4fa7c2d1
|
|
@ -2085,8 +2085,8 @@ subtest 'is_hold_group_target, cleanup_hold_group and set_as_hold_group_target t
|
|||
|
||||
$hold_2->cancel();
|
||||
is(
|
||||
$hold_3->hold_group, undef,
|
||||
'Third hold was left as the only member of its group. Group was deleted and the hold is no longer part of a hold group'
|
||||
$hold_3->hold_group->hold_group_id, $new_hold_group->hold_group_id,
|
||||
'Third hold was left as the only member of its group. Group is kept and this hold is still part of it for historic reasons.'
|
||||
);
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
|||
|
|
@ -3585,7 +3585,7 @@ subtest 'reset_2fa() tests' => sub {
|
|||
|
||||
subtest "create_hold_group, hold_groups, visual_hold_group_id tests" => sub {
|
||||
|
||||
plan tests => 17;
|
||||
plan tests => 19;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
|
@ -3643,7 +3643,7 @@ subtest "create_hold_group, hold_groups, visual_hold_group_id tests" => sub {
|
|||
is( $hold_group->hold_group_id, $hold3->get_from_storage->hold_group_id, 'hold3 added to hold_group' );
|
||||
|
||||
# Create 2nd hold group
|
||||
$patron->create_hold_group( [ $hold4->reserve_id, $hold5->reserve_id ] );
|
||||
my $hg_to_be_kept = $patron->create_hold_group( [ $hold4->reserve_id, $hold5->reserve_id ] );
|
||||
is( $patron_hold_groups->count, 2, 'Patron has two hold groups' );
|
||||
|
||||
my $second_hold_group = $patron->hold_groups->as_list->[1];
|
||||
|
|
@ -3658,13 +3658,21 @@ subtest "create_hold_group, hold_groups, visual_hold_group_id tests" => sub {
|
|||
);
|
||||
|
||||
$hold3->get_from_storage->fill();
|
||||
is( $patron->get_from_storage->hold_groups->count, 1, 'Patron only has one hold group again' );
|
||||
is( $patron->get_from_storage->hold_groups->count, 1, 'Patron only has one active hold group' );
|
||||
is(
|
||||
$patron->get_from_storage->hold_groups->next->hold_group_id, $hg_to_be_kept->hold_group_id,
|
||||
'Patron only has one active hold group. The 2nd created'
|
||||
);
|
||||
|
||||
$hold4->get_from_storage->cancel();
|
||||
is( $patron->get_from_storage->hold_groups->count, 0, 'Patron does not have any hold groups again' );
|
||||
is( $patron->get_from_storage->hold_groups->count, 1, 'Patron only has one active hold group' );
|
||||
is(
|
||||
$patron->get_from_storage->hold_groups->next->hold_group_id, $hg_to_be_kept->hold_group_id,
|
||||
'Patron only has one active hold group. The 2nd created. It was kept because one hold was cancelled and one hold remains.'
|
||||
);
|
||||
|
||||
# Create 3rd hold group
|
||||
$patron->create_hold_group( [ $hold5->reserve_id, $hold6->reserve_id ] );
|
||||
$patron->create_hold_group( [ $hold5->reserve_id, $hold6->reserve_id ], 1 );
|
||||
my $third_hold_group = $patron->hold_groups->as_list->[0];
|
||||
is( $third_hold_group->visual_hold_group_id, 1, 'Visual hold group id is 1' );
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ subtest "target_hold_id tests" => sub {
|
|||
my $hold = Koha::Holds->find($reserve_id);
|
||||
is( $hold_group->get_from_storage->target_hold_id, $hold->reserve_id, 'target_hold_id is correct' );
|
||||
$hold->fill();
|
||||
is( $hold_group->get_from_storage, undef, 'hold group no longer exists' );
|
||||
is( $hold_group->get_from_storage->hold_group_id, $hold->hold_group_id, 'hold_group is kept' );
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue