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. Remove 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.
Created attachment 102765 [details] [review] 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
Created attachment 103350 [details] [review] 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
In the patch you mention > This also obsoletes the "Get effective issuing rule in correct order" > test in t/db_dependent/Koha/IssuingRules.t why is it obsoleted?
(In reply to Joonas Kylmälä from comment #3) > In the patch you mention > > > This also obsoletes the "Get effective issuing rule in correct order" > > test in t/db_dependent/Koha/IssuingRules.t > > why is it obsole(In reply to Joonas Kylmälä from comment #3) > In the patch you mention > > > This also obsoletes the "Get effective issuing rule in correct order" > > test in t/db_dependent/Koha/IssuingRules.t > > why is it obsoleted? It is the test I refer to in the original post of this Bug. > 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. > Remove those "duplicates" ... Manually adding 2^n tests, where n is the number of scopes, is no longer needed because wiith this patch we are autogenerating those test cases.
Created attachment 106904 [details] [review] 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>
Created attachment 108963 [details] [review] 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>
Created attachment 108978 [details] [review] 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
Pushed to master for 20.11, thanks to everybody involved!
enhancement will not be backported to 20.05.x