-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Additional MVC Translator BC fixes #5692
Additional MVC Translator BC fixes #5692
Conversation
- Added `__call()` implementation to proxy unknown method calls to the underlying translator instance. - Added a `getTranslator()` method to allow direct access to the underlying translator instance. - Added unit tests for the above functionality.
- Ensure MVC implementation is an i18n translator implementation - Ensure MVC implementation is a validator translator implementation
- Tested all behaviors - Added a behavior: inject the i18n TranslatorInterface service if created via the Translator::factory
Ping @dstockto - this PR is what will fix your issues. |
{ | ||
public function setUp() | ||
{ | ||
$this->i18nTranslator = $this->getMock('Zend\I18n\Translator\Translator'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you mock the interface instead here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mock the interface as, later, in one of the test methods, I mock one of the method calls (setLocale
).
Apart from the CS failues, this looks good. Approved for merging. |
@weierophinney The new code did not fix the issue without code changes in the application, but putting in my service_manager config did get it to go back to working and translations are working again with no more fatal error. |
__call
method)getTranslator()
method to the MVC translatorZend\I18n\Translator\TranslatorInterface
service into the service manager if the MVC translator factory creates a new i18n Translator instance.This PR also adds unit tests for both the MVC translator and its associated factory.