Bug 24228: Make ->to_api params a hashref
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 23 Dec 2019 15:03:12 +0000 (12:03 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 8 Jan 2020 15:07:33 +0000 (15:07 +0000)
commit954c742cc63d569cdba06325904a88097c4cc2ba
tree18c167c7bf6692c189de813222f648e199ff153e
parentf87ebb9ab1eb61002a5b97f9bf31e2b5d77b25d0
Bug 24228: Make ->to_api params a hashref

This patch makes the parameters for Koha::Object(s)->to_api a hashref
preparing the ground for new parameters. The proposed syntax is:

$object->to_api(
    {
        embed => {
            'items' => {
                'children' => {
                    'homebranch' => {}
                }
            }
        }
    }
);

Tests are added for the Koha::Objects implementation and tests for
Koha::Object are adjusted to the new syntax, and a test for the single
result accessor is added as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Object.pm
Koha/Objects.pm
t/db_dependent/Koha/Object.t
t/db_dependent/Koha/Objects.t