Bug 30181: Make Koha::BackgroundJob->_derived_class return the right thing
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 25 Feb 2022 09:42:25 +0000 (06:42 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 22 Mar 2022 20:17:33 +0000 (10:17 -1000)
commitb6bdae7e9d0eef1247907534f8c856014b53d6c1
tree37103e7eb94b43ed439b475cc1581afbe3afe45c
parente13c7dbf51c7618e626300a88b48d6138112b1ea
Bug 30181: Make Koha::BackgroundJob->_derived_class return the right thing

This patch makes _derived_class rely on _new_from_dbic to generate a new
object with the right class, but based on the same DB row. Not an empty
one as it was before. This way we can remove some biolerplate that is
required now when writing background job classes.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Boo, tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/BackgroundJob.pm