Bug 26143: Regression tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 5 Aug 2020 15:04:47 +0000 (12:04 -0300)
committerAleisha Amohia <aleishaamohia@hotmail.com>
Sun, 16 Aug 2020 21:49:24 +0000 (09:49 +1200)
commit2b0bd07a2db8f4e5c255b6cace300a2d741eb08a
tree92c928d5e25423ca5bfe0bfa614f1ab0a6b45ea9
parentd6398f2f083ce9dfaebcd4e6298f5c611eb3d009
Bug 26143: Regression tests

This patch introduces tests for the per_page=-1 handling use case. From
now on per_page=-1 means 'all resources'.

On writing this I noticed that we always paginate results no matter
what, but there was a weird condition under which on pagination headers
were sent back to the API consumer. This is highlighted in the precedent
patch, which is not the -1 situation this one tries to tackle.

Both pagination and searching are broken with per_page=-1, which is a
standard, and we actually didn't explicitly set a way to request all
resources.

To verify this:
1. Apply the previous tests patch and this one
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Things are damn broken

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d20bc39d759bc9321b1b7accb952f90351a14caa)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9a4910812f03fade73d27db8ce975dc0a15fe9e7)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
t/Koha/REST/Plugin/Pagination.t
t/db_dependent/Koha/REST/Plugin/Objects.t