Summary: | Class with empty/no to_api_mapping should generate an empty from_api_mapping | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, fridolin.somers, jonathan.druart, kyle, m.de.rooy, martin.renvoize, nick, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
21.11.00,21.05.04,20.11.10
|
|
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 25260 | ||
Attachments: |
Bug 28744: Regression tests
Bug 28744: Better handling of undefined to_api_mapping Bug 28744: Regression tests Bug 28744: Better handling of undefined to_api_mapping Bug 28744: Regression tests Bug 28744: Better handling of undefined to_api_mapping Bug 28744: Better handling of undefined to_api_mapping Bug 28744: Regression tests Bug 28744: Regression tests Bug 28744: Better handling of undefined to_api_mapping |
Description
Tomás Cohen Arazi (tcohen)
2021-07-23 03:34:43 UTC
Created attachment 123069 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 123070 [details] [review] Bug 28744: Better handling of undefined to_api_mapping We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. This patch makes a small change so this method always returns an empty hashref. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Test fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 123152 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Created attachment 123153 [details] [review] Bug 28744: Better handling of undefined to_api_mapping We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. This patch makes a small change so this method always returns an empty hashref. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Test fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Created attachment 124162 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 124163 [details] [review] Bug 28744: Better handling of undefined to_api_mapping We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. This patch makes a small change so this method always returns an empty hashref. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Test fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 124189 [details] [review] Bug 28744: Better handling of undefined to_api_mapping We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. This patch makes a small change so this method always returns an empty hashref. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Test fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> JD amended patch: remove uneeded commented lines Created attachment 124190 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> JD amended patch: remove uneeded commented lines Created attachment 124238 [details] [review] Bug 28744: Regression tests This patch adds tests for the following cases: - to_api_mapping not defined - to_api_mapping returning an empty hashref To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail :-( Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> JD amended patch: remove uneeded commented lines Created attachment 124239 [details] [review] Bug 28744: Better handling of undefined to_api_mapping We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API. This patch makes a small change so this method always returns an empty hashref. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Test fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> JD amended patch: remove uneeded commented lines Pushed to master for 21.11, thanks to everybody involved! Pushed to 21.05.x for 21.05.04 Pushed to 20.11.x for 20.11.10 Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed. |