Bug 27858: Make Koha::Patron::Attribute->store raise an exception on invalid type...
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 4 Mar 2021 11:24:54 +0000 (08:24 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 9 Apr 2021 13:43:26 +0000 (15:43 +0200)
commitd816bad357b0ef29512754ee9de63dcb1408a9d5
treee5d69ab9116ceaea11360aea6d12658ed11a0242
parent032c66bfc96a3f9381e2734a63d0664f62313dba
Bug 27858: Make Koha::Patron::Attribute->store raise an exception on invalid type/code

This patch adds type validation to the ->store method. And exception
should be thrown if the type is invalid. Things currently explode in
such situations, so this doesn't change the behavior (just adding more
informative failure information).

To test:
1. Apply the previous patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron/Attribute.t
=> FAIL: No exception is thrown on the bad case, weird error
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Exception thrown!
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Patron/Attribute.pm