Bug 27333

Summary: Wrong exception thrown in Koha::Club::Hold::add
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, caroline.cyr-la-rose, fridolin.somers, martin.renvoize, tomascohen, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03,20.05.09,19.11.15
Bug Depends on: 27327    
Bug Blocks: 27330    
Attachments: Bug 27333: Regression tests
Bug 27333: Throw the right exceptions
Bug 27333: Regression tests
Bug 27333: Throw the right exceptions

Description Tomás Cohen Arazi 2021-01-04 14:14:12 UTC
It should be returning Koha::Exceptions::MissingParameter. And is returning a generic Koha::Exceptions::ClubHold exception.
Comment 1 Tomás Cohen Arazi 2021-01-04 14:17:44 UTC
Created attachment 114793 [details] [review]
Bug 27333: Regression tests

Test for the right exceptions
Comment 2 Tomás Cohen Arazi 2021-01-04 14:17:47 UTC
Created attachment 114794 [details] [review]
Bug 27333: Throw the right exceptions

If parameters are missing, we need to throw
Koha::Exceptions::MissingParameter exceptions.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Club/Hold.t
=> FAIL: Tests fail because the method doesn't throw the right
exceptions
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D
Comment 3 Martin Renvoize 2021-01-26 16:32:22 UTC
Created attachment 115827 [details] [review]
Bug 27333: Regression tests

Test for the right exceptions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-01-26 16:32:25 UTC
Created attachment 115828 [details] [review]
Bug 27333: Throw the right exceptions

If parameters are missing, we need to throw
Koha::Exceptions::MissingParameter exceptions.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Club/Hold.t
=> FAIL: Tests fail because the method doesn't throw the right
exceptions
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2021-01-26 16:33:09 UTC
Going for a straight QA here.

Follows best practice and is a clear improvement. No regressions found, QA scripts pass and regression tests are included.

Passing QA :)
Comment 6 Jonathan Druart 2021-01-27 13:37:38 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-01-29 14:29:15 UTC
Pushed to 20.11.x for 20.11.03
Comment 8 Andrew Fuerste-Henry 2021-02-04 21:25:55 UTC
Pushed to 20.05.x for 20.05.09
Comment 9 Victor Grousset/tuxayo 2021-02-08 23:20:06 UTC
Backported: Pushed to 19.11.x branch for 19.11.15