If get_password_expiry_date is passed a DateTime object as a parameter, it modifies and returns the original object. Bug 34117 removed this side effect from get_expiry_date, so we should remove this side effect from get_password_expiry_date as well.
Created attachment 153998 [details] [review] Bug 34435: Add unit test To test: prove t/db_dependent/Koha/Patron/Category.t
Created attachment 153999 [details] [review] Bug 34435: Remove side effect from get_password_expiry_date If get_password_expiry_date is passed a DateTime object as a parameter, it modifies and returns the original object. This can create possible side effects. This patch modifies get_password_expiry_date to clone the DateTime object that it receives as a parameter and return the modified clone, so that object references can be passed in safely. To test: prove t/db_dependent/Koha/Patron/Category.t
Created attachment 154100 [details] [review] Bug 34435: Add unit test To test: prove t/db_dependent/Koha/Patron/Category.t Signed-off-by: Sam Lau <samalau@gmail.com>
Created attachment 154101 [details] [review] Bug 34435: Remove side effect from get_password_expiry_date If get_password_expiry_date is passed a DateTime object as a parameter, it modifies and returns the original object. This can create possible side effects. This patch modifies get_password_expiry_date to clone the DateTime object that it receives as a parameter and return the modified clone, so that object references can be passed in safely. To test: prove t/db_dependent/Koha/Patron/Category.t Signed-off-by: Sam Lau <samalau@gmail.com>
Created attachment 154278 [details] [review] Bug 34435: Add unit test To test: prove t/db_dependent/Koha/Patron/Category.t Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 154279 [details] [review] Bug 34435: Remove side effect from get_password_expiry_date If get_password_expiry_date is passed a DateTime object as a parameter, it modifies and returns the original object. This can create possible side effects. This patch modifies get_password_expiry_date to clone the DateTime object that it receives as a parameter and return the modified clone, so that object references can be passed in safely. To test: prove t/db_dependent/Koha/Patron/Category.t Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Now that dependency bug 34117 is passed QA, this one can be too IIUC. Works (tests before implementation made it easy to check [U+1F44D]), makes sense, QA script happy, code looks good, passing QA :)
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.03
Nice work everyone! Pushed to 22.11.x for next release