Currently we duplicate some code used to build pagination parameters needed for page-numbers.inc, we should make this a subroutine and test it
Created attachment 93824 [details] [review] Bug 23763: Create a pagination_bar routine To test: prove -v t/Koha/SearchEngine/Search.t
Created attachment 93825 [details] [review] Bug 23763: Make search on staff and opac use new routine To test: 1 - Apply patch 2 - Search on staff and opac side 3 - Confirm you can paginate results 4 - Confirm you see 10 pages on pagination if under page 10 5 - Confirm you see 20 pages in pagination if over page 10 6 - Confirm you can go to first or last page
I'm getting a fail on running the tests - everything else seems okay: root@bed39bee2cb5:koha(23763)$ prove -v t/Koha/SearchEngine/Search.t t/Koha/SearchEngine/Search.t .. 1..5 # Subtest: pagination_bar tests 1..14 ok 1 - We paginate all hits if less than max_result_window ok 2 - We have hits/hits_to_paginate pages ok 3 - We calculate current page by offset/results_per_page plus 1 ok 4 - Previous page is current offset minus reults per page ok 5 - Next page is current offset plus reults per page ok 6 - Last page is pages minus 1 times reults per page ok 7 - If on first ten pages we only show 10 pages ok 8 - We paginate all hits if less than max_result_window ok 9 - We have hits/hits_to_paginate pages ok 10 - We calculate current page by offset/results_per_page plus 1 ok 11 - Previous page is current offset minus reults per page ok 12 - Next page is current offset plus reults per page ok 13 - Last page is pages minus 1 times reults per page ok 14 - If past first ten pages we show 20 pages ok 1 - pagination_bar tests # Looks like you planned 5 tests but ran 1. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 4/5 subtests Test Summary Report ------------------- t/Koha/SearchEngine/Search.t (Wstat: 65280 Tests: 1 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 5 tests but ran 1. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.86 cusr 0.07 csys = 0.95 CPU) Result: FAIL
Created attachment 114674 [details] [review] Bug 23763: Make search on staff and opac use new routine To test: 1 - Apply patch 2 - Search on staff and opac side 3 - Confirm you can paginate results 4 - Confirm you see 10 pages on pagination if under page 10 5 - Confirm you see 20 pages in pagination if over page 10 6 - Confirm you can go to first or last page
Created attachment 115720 [details] [review] Bug 23763: Create a pagination_bar routine To test: prove -v t/Koha/SearchEngine/Search.t Signed-off-by: David Nind <david@davidnind.com>
Created attachment 115721 [details] [review] Bug 23763: Make search on staff and opac use new routine To test: 1 - Apply patch 2 - Search on staff and opac side 3 - Confirm you can paginate results 4 - Confirm you see 10 pages on pagination if under page 10 5 - Confirm you see 20 pages in pagination if over page 10 6 - Confirm you can go to first or last page Signed-off-by: David Nind <david@davidnind.com>
Created attachment 116475 [details] [review] Bug 23763: Create a pagination_bar routine To test: prove -v t/Koha/SearchEngine/Search.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 116476 [details] [review] Bug 23763: Make search on staff and opac use new routine To test: 1 - Apply patch 2 - Search on staff and opac side 3 - Confirm you can paginate results 4 - Confirm you see 10 pages on pagination if under page 10 5 - Confirm you see 20 pages in pagination if over page 10 6 - Confirm you can go to first or last page Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 116477 [details] [review] Bug 23763: (QA follow-up) Add +x to Search.t file permissions Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 116515 [details] [review] Bug 23763: Create a pagination_bar routine To test: prove -v t/Koha/SearchEngine/Search.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> JD amended patch: perltidy
Created attachment 116516 [details] [review] Bug 23763: Make search on staff and opac use new routine To test: 1 - Apply patch 2 - Search on staff and opac side 3 - Confirm you can paginate results 4 - Confirm you see 10 pages on pagination if under page 10 5 - Confirm you see 20 pages in pagination if over page 10 6 - Confirm you can go to first or last page Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> JD amended patch: perltidy
It would have been good to have a bit more tests as we are not testing all the cases, neither the edge ones. But much better than what we had!
Pushed to master for 21.05, thanks to everybody involved!
Enhancement not pushed to 20.11.x