Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ValidatorPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public function injectTranslator($validator)
{
if ($validator instanceof Translator\TranslatorAwareInterface) {
$locator = $this->getServiceLocator();
if ($locator && $locator->has('translator')) {
$validator->setTranslator($locator->get('translator'));
if ($locator && $locator->has('MvcTranslator')) {
$validator->setTranslator($locator->get('MvcTranslator'));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/ValidatorPluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public function testAllowsInjectingTranslator()
{
$translator = $this->getMock('ZendTest\Validator\TestAsset\Translator');

$slContents = array(array('translator', $translator));
$slContents = array(array('MvcTranslator', $translator));
$serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
$serviceLocator->expects($this->once())
->method('get')
->will($this->returnValueMap($slContents));
$serviceLocator->expects($this->once())
->method('has')
->with($this->equalTo('translator'))
->with($this->equalTo('MvcTranslator'))
->will($this->returnValue(true));

$this->validators->setServiceLocator($serviceLocator);
Expand All @@ -51,7 +51,7 @@ public function testNoTranslatorInjectedWhenTranslatorIsNotPresent()
$serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
$serviceLocator->expects($this->once())
->method('has')
->with($this->equalTo('translator'))
->with($this->equalTo('MvcTranslator'))
->will($this->returnValue(false));

$this->validators->setServiceLocator($serviceLocator);
Expand Down

0 comments on commit a4f47c3

Please sign in to comment.