Bug 22059 - Wrong exception parameters in Koha::Patron->set_password
Summary: Wrong exception parameters in Koha::Patron->set_password
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Josef Moravec
URL:
Keywords:
Depends on: 21178
Blocks: 17006
  Show dependency treegraph
 
Reported: 2019-01-02 12:55 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2020-01-06 20:13 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 22059: regression tests (1.10 KB, patch)
2019-01-02 12:59 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22059: Fix exception params in Koha::Patron->set_password (1.20 KB, patch)
2019-01-02 12:59 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22059: regression tests (1.17 KB, patch)
2019-01-02 13:18 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 22059: Fix exception params in Koha::Patron->set_password (1.27 KB, patch)
2019-01-02 13:18 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 22059: regression tests (1.20 KB, patch)
2019-01-02 21:07 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 22059: Fix exception params in Koha::Patron->set_password (1.30 KB, patch)
2019-01-02 21:07 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 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 (tcohen) 2019-01-02 12:59:54 UTC
Created attachment 83574 [details] [review]
Bug 22059: regression tests
Comment 2 Tomás Cohen Arazi (tcohen) 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 (khall) 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 (khall) 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 (ashimema) 2019-01-10 13:25:36 UTC
Pushed to 18.11.x for 18.11.02
Comment 9 Lucas Gass (lukeg) 2019-01-10 15:49:07 UTC
21178 not in 18.05, not backporting