Summary: | Make Koha::Plugins::Base::_version_compare OO | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Kyle M Hall (khall) <kyle> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | fridolin.somers, kyle, lucas, martin.renvoize |
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: |
19.11.00,19.05.03
|
|
Circulation function: | |||
Bug Depends on: | 20669 | ||
Bug Blocks: | |||
Attachments: |
Bug 23230: Unit tests
Bug 23230: Make _version_compare OO context aware Bug 23230: (follow-up) Fix broken tests Bug 23230: Unit tests Bug 23230: Make _version_compare OO context aware Bug 23230: (follow-up) Fix broken tests Bug 23230: Unit tests Bug 23230: Make _version_compare OO context aware Bug 23230: (follow-up) Fix broken tests |
Description
Tomás Cohen Arazi (tcohen)
2019-06-28 15:08:56 UTC
(In reply to Tomás Cohen Arazi from comment #0) > This method is to be run inside plugin objects that inherit from > Koha::Plugins::Base, but calling > > $self->_version_compare(); > > won't work because the method doesn't expect $self to be passed. We should make it work either way since historically it has been non-OO and there are some plugins that may be using it in a non-OO way. I think ti should be easy to check the first parameter to know if it is being called as an object method or not! Created attachment 91152 [details] [review] Bug 23230: Unit tests Created attachment 91153 [details] [review] Bug 23230: Make _version_compare OO context aware On using _version_compare in plugins development, it would be nice if it was able to be called as an object method. This way we don't need to fully qualify it like this: Koha::Plugins::Base::_version_compare and we can do $self->_version_compare instead. This patch implements this behavior change. It is backwards compatible so plugins using the 'old way' don't break. To test: - Apply the unit tests patch - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: Tests fail - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass! - Sign off :-D Created attachment 91201 [details] [review] Bug 23230: (follow-up) Fix broken tests Before patch, the new tests don't run. After patch, they do. Created attachment 91202 [details] [review] Bug 23230: Unit tests Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 91203 [details] [review] Bug 23230: Make _version_compare OO context aware On using _version_compare in plugins development, it would be nice if it was able to be called as an object method. This way we don't need to fully qualify it like this: Koha::Plugins::Base::_version_compare and we can do $self->_version_compare instead. This patch implements this behavior change. It is backwards compatible so plugins using the 'old way' don't break. To test: - Apply the unit tests patch - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: Tests fail - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 91204 [details] [review] Bug 23230: (follow-up) Fix broken tests Before patch, the new tests don't run. After patch, they do. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> (In reply to M. Tompsett from comment #4) > Created attachment 91201 [details] [review] [review] > Bug 23230: (follow-up) Fix broken tests > > Before patch, the new tests don't run. > After patch, they do. I wonder what bug I attached my version of this patch he he Created attachment 91220 [details] [review] Bug 23230: Unit tests Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 91221 [details] [review] Bug 23230: Make _version_compare OO context aware On using _version_compare in plugins development, it would be nice if it was able to be called as an object method. This way we don't need to fully qualify it like this: Koha::Plugins::Base::_version_compare and we can do $self->_version_compare instead. This patch implements this behavior change. It is backwards compatible so plugins using the 'old way' don't break. To test: - Apply the unit tests patch - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: Tests fail - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 91222 [details] [review] Bug 23230: (follow-up) Fix broken tests Before patch, the new tests don't run. After patch, they do. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Nice work! Pushed to master for 19.11.00 Nice work! Pushed to master for 19.11.00 This is very useful for plugins so I choose to backport to stable. Pushed to 19.05.x for 19.05.03 Note this commit in master is not needed for 19.05.x : Bug 23230: (RM follow-up) Add rollback to plugin test everything applied cleanly and passed test so i am backporting this enchancment backported to 18.11.x for 18.11.09 |