Bug 24150

Summary: Add missing Koha::Old::*[s] classes
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: 1joynelson, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 21684, 24151    
Attachments: Bug 24150: Add Koha::Old::*[s]
Bug 24150: Add tests
Bug 24150: Add Koha::Old::*[s]
Bug 24150: Add tests
Bug 24150: fix wrong semicolon
Bug 24150: Add Koha::Old::*[s]
Bug 24150: Add missing koha_object[s]_class methods
Bug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers
Bug 24150: Prevent random failure comparing updated_on

Description Jonathan Druart 2019-12-03 15:45:04 UTC
This bug report will add new classes for:
  * Koha::Old::Patron[s]
  * Koha::Old::Biblio[s]
  * Koha::Old::Item[s]
  * Koha::Old::Biblioitem[s]
Comment 1 Jonathan Druart 2019-12-03 16:31:20 UTC
Created attachment 95954 [details] [review]
Bug 24150: Add Koha::Old::*[s]

This bug report will add new classes for:
  * Koha::Old::Patron[s]
  * Koha::Old::Biblio[s]
  * Koha::Old::Item[s]
  * Koha::Old::Biblioitem[s]

Sponsored-by: Association KohaLa - https://koha-fr.org/
Comment 2 Jonathan Druart 2019-12-03 16:31:36 UTC
Created attachment 95955 [details] [review]
Bug 24150: Add tests
Comment 3 Jonathan Druart 2019-12-03 16:32:40 UTC
Those classes will be used directly from bug 25151. Adding them on a separate bug report in case someone else needs them.

There is no useful test plan apart from proving the new tests.
Comment 4 Nick Clemens (kidclamp) 2019-12-13 16:48:29 UTC
Created attachment 96266 [details] [review]
Bug 24150: Add Koha::Old::*[s]

This bug report will add new classes for:
  * Koha::Old::Patron[s]
  * Koha::Old::Biblio[s]
  * Koha::Old::Item[s]
  * Koha::Old::Biblioitem[s]

Sponsored-by: Association KohaLa - https://koha-fr.org/

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Nick Clemens (kidclamp) 2019-12-13 16:48:32 UTC
Created attachment 96267 [details] [review]
Bug 24150: Add tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Nick Clemens (kidclamp) 2019-12-13 16:48:34 UTC
Created attachment 96268 [details] [review]
Bug 24150: fix wrong semicolon

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Martin Renvoize (ashimema) 2019-12-18 16:19:52 UTC
Created attachment 96428 [details] [review]
Bug 24150: Add Koha::Old::*[s]

This bug report will add new classes for:
  * Koha::Old::Patron[s]
  * Koha::Old::Biblio[s]
  * Koha::Old::Item[s]
  * Koha::Old::Biblioitem[s]

Sponsored-by: Association KohaLa - https://koha-fr.org/
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize (ashimema) 2019-12-18 16:20:30 UTC
Squashed and Passing QA
Comment 9 Martin Renvoize (ashimema) 2020-01-03 11:01:59 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 10 Jonathan Druart 2020-01-06 22:51:15 UTC
Created attachment 96867 [details] [review]
Bug 24150: Add missing koha_object[s]_class methods
Comment 11 Jonathan Druart 2020-01-06 22:53:07 UTC
Tests are failing with:

koha_1       |         #   Failed test 'Testing Koha::Old::Patrons'
koha_1       |         #   at t/db_dependent/TestBuilder.t line 397.
koha_1       |         #          got: ''
koha_1       |         #     expected: 'Koha::Old::Patron'
koha_1       | 
koha_1       |         #   Failed test 'Module Koha::Old::Patrons should have koha_object[s]_class method if needed'
koha_1       |         #   at t/db_dependent/TestBuilder.t line 399.
koha_1       |         #          got: 'Can't call method "get_from_storage" on an undefined value at t/db_dependent/TestBuilder.t line 398.
koha_1       |         # '
koha_1       |         #     expected: ''
koha_1       |         # Looks like you failed 2 tests of 70.
koha_1       | 
koha_1       |     #   Failed test 'Test all classes'
koha_1       |     #   at t/db_dependent/TestBuilder.t line 409.
koha_1       |     # Looks like you planned 5 tests but ran 4.
koha_1       |     # Looks like you failed 1 test of 4 run.
koha_1       | 
koha_1       | #   Failed test 'build_object() tests'
koha_1       | #   at t/db_dependent/TestBuilder.t line 425.
koha_1       | Can't call method "_result" on an undefined value at t/db_dependent/TestBuilder.t line 402.

This patch is not enough to fix them, a  PK is missing on deletedborrowers, I am going to fix that ASAP, certainly will need to open a new bug report to deal with that.

Do not backport!
Comment 12 Jonathan Druart 2020-01-07 10:40:49 UTC
Created attachment 96871 [details] [review]
Bug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers

deletedborrowers does not have a PK, and adding it is out of the scope
of this patchset. Indeed we will have to handle possible duplication of
borrowernumber values, which does not seem trivial.
Having bug 20271 in mind, we will have to deal with this problematic
anyway later.
Comment 13 Jonathan Druart 2020-01-07 10:41:28 UTC
RMaints: we should not backport this patchset.
Comment 14 Martin Renvoize (ashimema) 2020-01-07 13:52:05 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Jonathan Druart 2020-01-07 15:03:51 UTC
Created attachment 96897 [details] [review]
Bug 24150: Prevent random failure comparing updated_on

Jenkins is currently failing (slow server, datetime comparison, etc.)

koha_1       |     #   Failed test at t/db_dependent/Koha/Old.t line 48.
koha_1       |     #     Structures begin differing at:
koha_1       |     #          $got->{updated_on} = '2020-01-07 14:15:22'
koha_1       |     #     $expected->{updated_on} = '2020-01-07 14:15:21'
koha_1       |     # Looks like you failed 1 test of 1.
koha_1       |
koha_1       | #   Failed test 'Koha::Old::Patrons'
koha_1       | #   at t/db_dependent/Koha/Old.t line 49.
koha_1       | # Looks like you failed 1 test of 2.
koha_1       | [14:15:22] t/db_dependent/Koha/Old.t ...............................................
Comment 16 Martin Renvoize (ashimema) 2020-01-07 16:28:20 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 17 Joy Nelson 2020-01-18 15:08:28 UTC
Not backported to 19.11.x