Bug 21912

Summary: Koha::Objects->search lacks tests
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, jesse, jonathan.druart, kyle, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 21912: Add tests for Koha::Objects->search
Bug 21912: Add tests for Koha::Objects->search
Bug 21912: (QA follow-up) Do not delete existing patrons

Description Tomás Cohen Arazi (tcohen) 2018-11-29 14:58:07 UTC
The 'search' method in Koha::Objects uses the context in which it was called to return either an iterator (in scalar context) or a list of singular objects, in list context.

This behaviour should be covered by tests.
Comment 1 Tomás Cohen Arazi (tcohen) 2018-11-29 15:00:44 UTC
Created attachment 82745 [details] [review]
Bug 21912: Add tests for Koha::Objects->search

This patch adds simple tests for the current behaviour. Specifically the
return values in both scalar and list context.

To test:
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass
- Sign off :-D
Comment 2 Martin Renvoize (ashimema) 2018-11-29 15:33:11 UTC
Created attachment 82750 [details] [review]
Bug 21912: Add tests for Koha::Objects->search

This patch adds simple tests for the current behaviour. Specifically the
return values in both scalar and list context.

To test:
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize (ashimema) 2018-11-29 15:35:10 UTC
Trivial patch to increase the test coverage.. straight to PQA
Comment 4 Tomás Cohen Arazi (tcohen) 2018-12-26 17:56:32 UTC
Created attachment 83514 [details] [review]
Bug 21912: (QA follow-up) Do not delete existing patrons

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Nick Clemens (kidclamp) 2019-01-11 13:34:00 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize (ashimema) 2019-01-14 14:07:45 UTC
Never a bad idea to increase test coverage... choosing to backport this 'tests only' patch.

Pushed to 18.11.x for 18.11.02
Comment 7 Jesse Maseto 2019-01-23 19:24:04 UTC
Pushed to 18.05.x for 18.05.09
Comment 8 Fridolin Somers 2019-01-30 08:03:43 UTC
Pushed to 17.11.x for 17.11.15