Bug 30203: Circulation.t: prevent locking by setting envvar

Running this test without prove is disastrous. The LOCK in
the called SendCirculationAlert will ruin your data.
But no longer when you apply this patch.

Test plan:
Run prove Circulation.t
Inspect your data (e.g. borrowers table).
Run perl Circulation.t
Inspect your data (e.g. borrowers table) again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ac53c18af0)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2022-03-03 10:27:20 +00:00 committed by Andrew Fuerste-Henry
parent 7bc90af0be
commit 82e7c4020d
1 changed files with 5 additions and 0 deletions

View File

@ -4905,6 +4905,11 @@ subtest "updateWrongTransfer tests" => sub {
subtest "SendCirculationAlert" => sub {
plan tests => 2;
# When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK.
# LOCK will commit changes and ruin your data
# In order to prevent that, we will add KOHA_TESTING to $ENV; see further Circulation.pm
$ENV{KOHA_TESTING} = 1;
# Setup branch, borrowr, and notice
my $library = $builder->build_object({ class => 'Koha::Libraries' });
set_userenv( $library->unblessed);