-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Zonemaster::Engine::Translator’s instance() method #1347
Fix Zonemaster::Engine::Translator’s instance() method #1347
Conversation
A programming error in Zonemaster::Engine::Translator’s instance() method caused the global variable $instance to be immediately undefined right after the initialize() function set it to an instance of a Translator object, if that singleton object hadn’t been previously instanciated. The documentation for Zonemaster::Engine::Translator’s initialize() method was also incorrect: this function takes a raw list of arguments, not a hash reference. Do not use the new() method in the corresponding unit tests anymore, because that method is deprecated.
The documentation for Zonemaster::Engine::Translator still referred to Moose in one place.
b8895fe
to
c65eb5b
Compare
I’m keeping this PR as a draft for now, because I’m considering also deprecating the |
That’s better done in another PR. |
Pull request zonemaster-engine#1347 (zonemaster/zonemaster-engine#1347) has been merged, which fixes Zonemaster::Backend::Translator->instance(). So we can remove one use of the deprecated Zonemaster::Backend::Translator->new() in the unit tests.
Purpose
This PR fixes a bug in Zonemaster::Engine::Translator that causes problems in Zonemaster::Backend::Translator (in Backend, not Engine), which inherits from Zonemaster::Engine::Translator.
Context
While adding unit tests in Zonemaster::Backend for its Translator module, I noticed that the
instance()
method in Zonemaster::Engine::Translator always returnedundef
instead of a Translator object.Changes
instance()
method which prevented it from working as documented.instance()
instead ofnew()
, to exercise the code.How to test this PR
Run the test suite in Zonemaster::Engine. Expect all unit tests to pass.