Koha/t/Koha
Tomas Cohen Arazi 741b9a1c73
Bug 24191: Add to_model param to _build_order_atom and dbic_merge_sorting
This patch adds a to_model parameter to dbic_merge_sorting so it is
passed when used (for example from objects.search). The to_model param
is passed along to the _build_order_atom method where it is finally
used.

In the process I wrote tests that reflected some problems in the current
code:
- Mojolicious automatically returns a scalar if a query parameter only
happens once on a request. The code expected an arrayref in every case.
- There's a design issue that forced me to use some hacky code in
_build_order_atom.

The first issue is dealth with, by using Scalar::Util::reftype as the
Perl docs recommend.

The second issue, I don't plan to clean it here, as there's ongoing work
on a Koha::Objects->search_from_api method that will obsolete this code
most probably (see bug 23893 for a better picture of where the mappings
will be living soon).

To test:
1. Apply this patch
2. Run:
  $ kshell
 k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!!
3. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-10 16:17:10 +00:00
..
Authority
I18N/po/xx_XX/LC_MESSAGES
Plugins Bug 23050: (QA follow-up) Add Koha::Plugins::Tab class 2019-11-05 08:13:59 +00:00
REST/Plugin Bug 24191: Add to_model param to _build_order_atom and dbic_merge_sorting 2019-12-10 16:17:10 +00:00
SearchEngine Bug 23089: Unit tests 2019-11-03 07:33:56 +00:00
Util
Config.t
Exceptions.t
I18N.t
ItemType.t
RDF.t
Script.t
Script_cron.t
Z3950responder.t