Bug 29746: Add Koha::Result::Boolean
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 21 Dec 2021 12:44:24 +0000 (09:44 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 5 Jan 2022 23:33:46 +0000 (13:33 -1000)
commita8ab17f82326e34b7a6708e636ab56230a7399a0
tree6c0f598a3af324f485dd0276143d23a68042e909
parent01a38cfebd943602c35b2440d0be2f6578eec6a4
Bug 29746: Add Koha::Result::Boolean

This patch introduces a new OO class that can be used as return value
from methods that need to return boolean values, but also provide some
feedback. This last bit is implemented using Koha::Object::Message
objects that can carry valuable information.

This class can also implement a `to_api()` method so it is suitable for
API usage. And so the Koha::Object::Message class. Will be done as
needed.

If some other result types are required, then we can move some of the
messaging logic to a top-level Koha::Result class this one inherits from
(and the new one as well, say, Integer?).

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/Koha/Result/Boolean.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Result/Boolean.pm [new file with mode: 0644]