Bug 23152 - koha_object[s]_class methods must be implemented when needed
Summary: koha_object[s]_class methods must be implemented when needed
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-19 02:41 UTC by Jonathan Druart
Modified: 2019-10-24 16:02 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.00


Attachments
Bug 23152: Add tests (886 bytes, patch)
2019-06-19 02:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 23152: Implement koha_object[s]_class when needed (42.30 KB, patch)
2019-06-19 02:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 23152: Add tests (951 bytes, patch)
2019-06-19 16:06 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 23152: Implement koha_object[s]_class when needed (42.36 KB, patch)
2019-06-19 16:06 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 23152: Fix more pluralisation (and add tests) (6.28 KB, patch)
2019-06-25 22:26 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2019-06-19 02:41:53 UTC
We should implement koha_object_class and koha_objects_class for all our modules.

For instance we cannot do Koha::Hold->get_from_storage from tests, it will result in the following error: 

Can't locate object method "_new_from_dbic" via package "Koha::Reserve" (perhaps you forgot to load "Koha::Reserve"?) at /home/vagrant/kohaclone/Koha/Object.pm line 267.
Comment 1 Jonathan Druart 2019-06-19 02:43:45 UTC
Created attachment 90765 [details] [review]
Bug 23152: Add tests
Comment 2 Jonathan Druart 2019-06-19 02:43:49 UTC
Created attachment 90766 [details] [review]
Bug 23152: Implement koha_object[s]_class when needed

A simple use case is the ->get_from_storage (useful when writing tests)

Test plan:
Apply only the first patch and notice the test failures
Apply the second patch and confirm the the tests are returning green
Comment 3 Martin Renvoize 2019-06-19 16:06:56 UTC
Created attachment 90803 [details] [review]
Bug 23152: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2019-06-19 16:06:59 UTC
Created attachment 90804 [details] [review]
Bug 23152: Implement koha_object[s]_class when needed

A simple use case is the ->get_from_storage (useful when writing tests)

Test plan:
Apply only the first patch and notice the test failures
Apply the second patch and confirm the the tests are returning green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2019-06-19 16:08:49 UTC
This is a bit of a no-brainer and something I've been meaning to get around to doing myself for a while.

Going straight for PQA as the patch is trivial to read and the qa scripts don't complain.

The test currently fails, but the reason is clear and it just warrants an RM followup on push to bring it up to date with the available classes at the time of push.

Passing QA.
Comment 6 Jonathan Druart 2019-06-19 16:11:36 UTC
(In reply to Martin Renvoize from comment #5)
> This is a bit of a no-brainer

I wrote a script ;)
Comment 7 Martin Renvoize 2019-06-24 16:03:42 UTC
Nice work!

Pushed to master for 19.11.00
Comment 8 Martin Renvoize 2019-06-25 05:51:57 UTC
I missed that the tests here don't actually test the koha_objects_class at all here.. would be good to get a test for that method too.
Comment 9 Jonathan Druart 2019-06-25 22:26:49 UTC
Created attachment 91005 [details] [review]
Bug 23152: Fix more pluralisation (and add tests)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Martin Renvoize 2019-10-24 16:02:39 UTC
Pushed the last follow-up.. oops.. i missed this one for ages :S