Browse Source

Bug 27797: (QA follow-up) Make tests more robust

This patch makes the tests mock things so the complex holds scenarios
where existing data could interfere, don't get in the middle with what
we need to test.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Nothing broke

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Tomás Cohen Arazi 3 years ago
committed by Jonathan Druart
parent
commit
35f7e0ca1c
  1. 15
      t/db_dependent/api/v1/holds.t

15
t/db_dependent/api/v1/holds.t

@ -1036,6 +1036,21 @@ subtest 'add() tests' => sub {
return Koha::Libraries->search( { branchcode => [ $library_2->branchcode, $library_3->branchcode ] } );
});
my $can_be_reserved = 'OK';
my $mock_reserves = Test::MockModule->new('C4::Reserves');
$mock_reserves->mock( 'CanItemBeReserved', sub
{
return { status => $can_be_reserved }
}
);
$mock_reserves->mock( 'CanBookBeReserved', sub
{
return { status => $can_be_reserved }
}
);
my $biblio = $builder->build_sample_biblio;
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });

Loading…
Cancel
Save