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)
committerJoy Nelson <joy@bywatersolutions.com>
Sat, 18 Jan 2020 16:24:29 +0000 (16:24 +0000)
commit48e304c7abab63eefbeb7b9d846463b5dbbc0c8f
treec3768246c01d0142d5868fed81cda663b3c8e264
parent59a92c1036ce73e56410c8ff317e19550fdb2e99
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>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
Koha/Object.pm
Koha/Objects.pm
t/db_dependent/Koha/Object.t
t/db_dependent/Koha/Objects.t