Koha-clms/t/Koha
Tomas Cohen Arazi 014d0abd3a 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>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 46895911d4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d9ec59f191)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-01-10 10:22:12 +13:00
..
Authority Bug 14769: (QA follow-up) Remove global var $cached_indicators 2018-04-12 10:50:36 -03:00
I18N/po/xx_XX/LC_MESSAGES Bug 15395: Allow correct handling of plural translation 2018-11-08 15:55:50 +00:00
REST/Plugin Bug 24191: Add to_model param to _build_order_atom and dbic_merge_sorting 2020-01-10 10:22:12 +13:00
SearchEngine Bug 23089: [18.11.x] fix tests 2019-12-19 10:08:21 +13:00
Util Bug 21560: Unit test for Koha::Util::OpenDocument 2019-03-19 09:35:34 +00:00
Config.t Bug 19760: Fix Config.t test 2017-12-22 14:04:52 -03:00
Exceptions.t Bug 21478: Add Koha::Exceptions::Hold 2019-02-01 12:00:18 +00:00
I18N.t Bug 15395: Allow correct handling of plural translation 2018-11-08 15:55:50 +00:00
ItemType.t Bug 12748: (QA followup) make new tests pass 2016-04-26 20:20:14 +00:00
RDF.t Bug 18586: Create module to mint RDF subject URIs 2018-08-09 12:11:16 +00:00