Bug 25113: Refactor CirculationRules.t when testing scope combinations
authorLari Taskula <lari.taskula@hypernova.fi>
Sat, 4 Apr 2020 15:01:02 +0000 (15:01 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Aug 2020 10:00:39 +0000 (12:00 +0200)
commit5b61408eb736d8a795eaeb9f7b44583d79e8b66a
tree00474d3e0e4995ce29418554b9b9db4b3f341246
parentbbf209133e0503df28ab1ae004e560f42425918b
Bug 25113: Refactor CirculationRules.t when testing scope combinations

We used to test rule scopes by explicitly defining each combination.

When adding new scopes, it is much easier if these tests are auto-
generated for you so that you don't have to repeat similar code.

This patch removes those "duplicates" and adds a method that returns
test cases for each scope as follows:

branchcode categorycode itemtype
__________ ____________ ________
branchcode categorycode itemtype
branchcode categorycode *
branchcode *            itemtype
branchcode *            *
*          categorycode itemtype
*          categorycode *
*          *            itemtype
*          *            *

And automatically extends the test when new scopes are added.

This also obsoletes the "Get effective issuing rule in correct order"
test in t/db_dependent/Koha/IssuingRules.t

To test:
1. prove t/db_dependent/Koha/CirculationRules.t

Sponsored-by: The National Library of Finland
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: perl tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha/CirculationRules.t
t/db_dependent/Koha/IssuingRules.t