Bug 21155: Prevent SwitchOnSiteCheckouts.t to fail randomly
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 16 Oct 2018 13:27:37 +0000 (10:27 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 9 Nov 2018 11:57:51 +0000 (12:57 +0100)
commitae754c73e0dabe77157f25c5be3023353773c019
tree6694558a1d48f027bff8ce021d98de8e3ec86df5
parent9a67ccab56a055e5707b1df353f3b8b7a9fa1a8d
Bug 21155: Prevent SwitchOnSiteCheckouts.t to fail randomly

 #   Failed test 'The date_due should have been set depending on the circ
 rules when the on-site checkout has been switched'
 #   at t/db_dependent/Circulation/SwitchOnSiteCheckouts.t line 126.
 #          got: '2018-10-16T23:59:00'
 #     expected: '2018-10-21T23:59:00'

TestBuilder set date to today, so issuingrules.harduedate will be set to
today.
issuingrules.hardduedatecompare will be set to an integer.
If set to 0, $datedue will be reset to the hard due date

The call stack is: AddIssue > CalcDateDue > GetHardDueDate

In GetHardDueDate:
3509         if ( $hardduedatecompare == 0 || $hardduedatecompare == $cmp ) {
3510             $datedue = $hardduedate->clone;
3511         }

To fix this random failure we need to set issuingrules.harduedate to undef.

Test plan:
0. Do not apply this patch
1. Modify the test to set hardduedatecompare to 0 (search 'my $issuingrule = ')
2. Execute the test and confirm the failure
3. Apply this patch
4. Execute the test and confirm the it is no longer failing

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 4e6d9defc180204461f80477be287ade7fcfc11b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit c82207ebb5487660e70c7091195d67be4b434139)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
t/db_dependent/Circulation/SwitchOnSiteCheckouts.t