]> git.koha-community.org Git - koha.git/commit
Bug 23770: Unit tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 8 Oct 2019 15:13:23 +0000 (12:13 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 21 Oct 2019 09:03:59 +0000 (10:03 +0100)
commit7ce5cb0865fb7eb9174a4b4edbf80e9acfcda920
tree5141569a4a68c91a79ba9f2a58ebde20e78fbf25
parentab4a8755c22269dbe0f8809667c0e0f1e03bc3ea
Bug 23770: Unit tests

This patch introduces tests for the new to_api method introduced in
Koha::Object(s).

It uses Koha::City as a sample for simplicity. And it also uses
Koha::Illrequests to test the case in which there's no to_api_mapping
method defined on the class, to highlight that a fallback to calling
TO_JSON is done. [1]

[1] This is done under the assumption Illrequests controller code
doesn't use any kind of mapping as the rest of the API controllers do,
so there's little chance it would be added in a future.

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

Sponsored-by: ByWater Solutions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
t/db_dependent/Koha/Object.t
t/db_dependent/Koha/Objects.t