Koha-clms/t/db_dependent/Koha
Tomas Cohen Arazi 1ddd0ef3cb Bug 27034: Do not use path parameters on building the query
This patch simply removes the use of path parameters on building the
query in $c->objects->search.

The sample usage in the original tests considers a specific use case in
which the 'nested' resultset has the path param in its attributes:

GET /patrons/:patron_id/holds

In this case, $c->objects->search would be passed a Koha::Holds
resultset into which it would build a query. As the patron_id param can
be mapped into a Koha::Hold attribute, this works.

We don't actually use this approach in code. What we do is searching for
the patron, and properly return a 404 if the patron doesn't exist [1]. If it
exists, we actually call $patron->holds to get the related resultset, so
there's no gain in having the path param on the query afterwards.

That said, if we wanted to build:

GET /holds/:hold_id/pickup_locations

as the latter is a calculated value, from a resultset that doesn't
actually include a (mapped to some attribute) hold_id attribute, there's
no way to use it if it will automatically add the hold_id to the
pickup_locations resultset. It will give errors about hold_id not being
an attribute of Koha::Library (Branches.pm actually).

So this patch removes the automatic use of path parameters in
$c->objects->search. We can extract them in the controller and add them
to the passed resultset if required. But this patch removes a constraint
we have for building routes controllers right now.

[1] If we didn't return the 404, and we just passed a fresh Koha::Holds
resultset to be feeded with the patron_id, we would always return an
empty array in cases where the patron doesn't exist. This would be
misleading, but I'm open to discuss it. Design-wise.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-29 09:03:45 +01:00
..
Account Bug 24603: Simplify tests using TestBuilder 2020-11-10 15:00:14 +01:00
Acquisition Bug 25670: Regression tests 2021-01-28 16:41:10 +01:00
Biblio Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
BiblioUtils Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Cash Bug 26172: (QA follow-up) Add tests for previous cashups 2020-11-05 15:24:20 +01:00
Charges Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Checkouts Bug 27004: Regression tests 2021-01-04 13:29:47 +01:00
Club Bug 27333: Regression tests 2021-01-27 10:45:54 +01:00
Config Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Filter Bug 26250: Fix tests when SearchEngine=Elastic 2020-08-31 16:10:26 +02:00
IssuingRules Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Item Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Library Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Objects/Mixin
…
Patron Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
Patrons Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Plugins Bug 26470: Regression tests 2020-09-18 10:38:01 +02:00
REST Bug 27034: Do not use path parameters on building the query 2021-01-29 09:03:45 +01:00
SMTP Bug 26595: Remove password from the smtp_server API object 2020-10-14 15:53:38 +02:00
SearchEngine Bug 27307: Unit test 2021-01-12 16:02:35 +01:00
Subscription Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Tags Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Template/Plugin Bug 24665: (QA follow-up) Add tests for 'selected' 2020-11-06 17:30:08 +01:00
XSLT Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Z3950Responder Bug 27149: Unit tests 2021-01-12 11:19:41 +01:00
Account.t Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
ActionLogs.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
ApiKeys.t Bug 26157: Hide expected DBI warnings from tests 2020-08-24 11:19:03 +02:00
Authorities.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
BackgroundJobs.t Bug 27317: (Bug 27127 follow-up) fix t/db_dependent/Koha/BackgroundJobs.t 2020-12-30 12:05:12 -03:00
Biblio.t Bug 27062: Fix pickup_location tests when existing libraries exist 2020-11-20 10:34:54 +01:00
BiblioFrameworks.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Biblios.t Bug 26921: Don't generate an invalid custom cover image if the url cannot be generated 2020-12-21 10:07:48 +01:00
Checkout.t Bug 26327: Add exec flag on .t file 2020-10-14 14:50:07 +02:00
Checkouts.t Bug 23916: (QA follow-up) Adapt all the things to the new column and accessor names 2020-11-10 15:00:14 +01:00
CirculationRules.t Bug 23091: Update unit test 2020-11-06 15:55:17 +01:00
Cities.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
ClassSortRules.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
ClassSources.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
ClassSplitRules.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
CoverImages.t Bug 26145: Add exec flag on .t file 2020-10-12 12:36:27 +02:00
CsvProfiles.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Database.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Desks.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Hold.t Bug 27209: (follow-up) Add ->is_pickup_location_valid 2020-12-21 10:07:45 +01:00
Holds.t Bug 24412: (follow-up) qa-tools 2020-11-06 15:55:17 +01:00
IssuingRules.t Bug 23091: Update unit test 2020-11-06 15:55:17 +01:00
Item.t Bug 27062: Fix pickup_location tests when existing libraries exist 2020-11-20 10:34:54 +01:00
ItemTypes.t Bug 27491: Rename system preference opaclanguages to OPACLanguages 2021-01-22 14:59:27 +01:00
Items.t Bug 24254: (QA follow-up) Inlines opachiddenitems handling 2021-01-14 14:03:49 +01:00
KeyboardShortcuts.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Libraries.t Bug 22818: (QA follow-up) Email addressing corrections 2020-11-11 08:35:10 +01:00
Library.t Bug 26595: Embed the whole smtp_server object 2020-10-14 15:53:38 +02:00
MarcSubfieldStructures.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
News.t Bug 24398: Fix 500 when viewing a single news item at the OPAC 2020-12-26 17:58:38 +01:00
Notices.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Object.t Bug 26555: Make sure _messages is always initialized 2020-10-15 14:50:06 +02:00
Objects.t Bug 26984: (follow-up) Don't delete patrons and checkouts in Objects.t 2020-11-20 08:16:02 +01:00
Old.t Bug 26327: Add ->library method to Koha::*Checkout 2020-10-14 14:50:06 +02:00
Patron.t Bug 19382: Adjust comment in test 2020-10-14 14:50:07 +02:00
Patrons.t Bug 23916: (follow-up) Fix unit test 2020-11-10 15:00:14 +01:00
Pseudonymization.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Quotes.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Ratings.t Bug 26250: Fix tests when SearchEngine=Elastic 2020-08-31 16:10:26 +02:00
Reports.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Reviews.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
SMS_Providers.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
SearchField.t Bug 19482: (follow-up) Fix update, add tests, restore closing </td> 2020-11-04 12:59:33 +01:00
SharedContent.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Statistics.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Subscription.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Suggestion.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Suggestions.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Tags.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
Z3950Servers.t Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00