Commit a780ef71 authored by Fabien Potencier's avatar Fabien Potencier

bug #1538 Fixed translator.resources definition (skalpa)

This PR was merged into the 2.1.x-dev branch.

Discussion
----------

Fixed translator.resources definition

`translator.resource` is wrongly registered as a protected closure in `TranslationServiceProvider` (it was originally added correctly in dd270386, but changed in 48a3fdc4).

That makes a test fail with Pimple 3.2.1 due to the silexphp/Pimple#190 fix as `translator.resource` can't be extended.

Commits
-------

c5dc42a7 Fixed translator.resources definition
parents 74d9869d c5dc42a7
...@@ -80,9 +80,9 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe ...@@ -80,9 +80,9 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe
return new MessageSelector(); return new MessageSelector();
}; };
$app['translator.resources'] = $app->protect(function ($app) { $app['translator.resources'] = function ($app) {
return array(); return array();
}); };
$app['translator.domains'] = array(); $app['translator.domains'] = array();
$app['locale_fallbacks'] = array('en'); $app['locale_fallbacks'] = array('en');
......
...@@ -82,7 +82,7 @@ class ValidatorServiceProviderTest extends TestCase ...@@ -82,7 +82,7 @@ class ValidatorServiceProviderTest extends TestCase
*/ */
public function testValidatorServiceIsAValidator($app) public function testValidatorServiceIsAValidator($app)
{ {
$this->assertTrue($app['validator'] instanceof ValidatorInterface || $app['validator'] instanceof LegacyValidatorInterface ); $this->assertTrue($app['validator'] instanceof ValidatorInterface || $app['validator'] instanceof LegacyValidatorInterface);
} }
/** /**
...@@ -192,4 +192,15 @@ class ValidatorServiceProviderTest extends TestCase ...@@ -192,4 +192,15 @@ class ValidatorServiceProviderTest extends TestCase
$this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr')); $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr'));
} }
public function testTranslatorResourcesIsArray()
{
$app = new Application();
$app['locale'] = 'fr';
$app->register(new ValidatorServiceProvider());
$app->register(new TranslationServiceProvider());
$this->assertInternalType('array', $app['translator.resources']);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment