Bug 14570: Add error handling to Koha::Patron::Relationship->store
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 12 Aug 2019 19:13:25 +0000 (16:13 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 20 Aug 2019 15:05:57 +0000 (16:05 +0100)
commit540136bb470ec66bff45881e97f51897bee731d8
treef67f8bbc0f0115dad024bb3aa0a125c044c6ff31
parentabb801ebbc986b40573ecfb3d7ce3093dd67f803
Bug 14570: Add error handling to Koha::Patron::Relationship->store

This patch adds checks on the values for the 'relationship'. This is
done to avoid future problems when migrating relationships from the
plain text syspref into (why not) a proper table. And to preserve
consistency.

There's also catching on possible broken constraints and throwing a new
exception

Tests are added for both the new exceptions and the changes to
Koha::Patron::Relationship.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/Exceptions.t \
          t/db_dependent/Koha/Patron.t \
          t/db_dependent/Koha/Patron/Relationship.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Exceptions/Patron/Relationship.pm [new file with mode: 0644]
Koha/Patron/Relationship.pm
t/Koha/Exceptions.t
t/db_dependent/Koha/Patron.t [new file with mode: 0644]
t/db_dependent/Koha/Patron/Relationship.t [new file with mode: 0644]