Bug 22059

Summary: Wrong exception parameters in Koha::Patron->set_password
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: normal    
Priority: P5 - low CC: josef.moravec, lucas, martin.renvoize, nick, tomascohen
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:
Bug Depends on: 21178    
Bug Blocks: 17006    
Attachments: Bug 22059: regression tests
Bug 22059: Fix exception params in Koha::Patron->set_password
Bug 22059: regression tests
Bug 22059: Fix exception params in Koha::Patron->set_password
Bug 22059: regression tests
Bug 22059: Fix exception params in Koha::Patron->set_password

Description Tomás Cohen Arazi 2019-01-02 12:55:23 UTC
Exception::Class requires parameters to be passed as a list instead of a hashref. Then

this is wrong:
Koha::Exceptions::Password::TooShort->throw({ length => $password_length, min_length => $min_length });

this is ok:
Koha::Exceptions::Password::TooShort->throw( length => $password_length, min_length => $min_length );

This is a minor issue anyway, preventing exceptions from being stringified correctly.
Comment 1 Tomás Cohen Arazi 2019-01-02 12:59:54 UTC
Created attachment 83574 [details] [review]
Bug 22059: regression tests
Comment 2 Tomás Cohen Arazi 2019-01-02 12:59:57 UTC
Created attachment 83575 [details] [review]
Bug 22059: Fix exception params in Koha::Patron->set_password

This simple patch fixes a wrong call to ->throw. Parameters shouldn't be
enclosed in curly brackets.

To test:
- Apply the tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patrons.t
=> FAIL: Tests fail because the throw call is wrong
- Apply this patch
- Run:
 k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass!
-Sign off :-D
Comment 3 Kyle M Hall 2019-01-02 13:18:02 UTC
Created attachment 83576 [details] [review]
Bug 22059: regression tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall 2019-01-02 13:18:13 UTC
Created attachment 83577 [details] [review]
Bug 22059: Fix exception params in Koha::Patron->set_password

This simple patch fixes a wrong call to ->throw. Parameters shouldn't be
enclosed in curly brackets.

To test:
- Apply the tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patrons.t
=> FAIL: Tests fail because the throw call is wrong
- Apply this patch
- Run:
 k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass!
-Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Josef Moravec 2019-01-02 21:07:44 UTC
Created attachment 83607 [details] [review]
Bug 22059: regression tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Josef Moravec 2019-01-02 21:07:47 UTC
Created attachment 83608 [details] [review]
Bug 22059: Fix exception params in Koha::Patron->set_password

This simple patch fixes a wrong call to ->throw. Parameters shouldn't be
enclosed in curly brackets.

To test:
- Apply the tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patrons.t
=> FAIL: Tests fail because the throw call is wrong
- Apply this patch
- Run:
 k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass!
-Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Nick Clemens (kidclamp) 2019-01-08 15:56:27 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-01-10 13:25:36 UTC
Pushed to 18.11.x for 18.11.02
Comment 9 Lucas Gass 2019-01-10 15:49:07 UTC
21178 not in 18.05, not backporting