From 8666c89111b3ae2558ad7c416641860ee6c86a80 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 15 Sep 2016 23:35:35 +0700 Subject: [PATCH 1/2] add more aliases at LoaderPluginManager --- src/Translator/LoaderPluginManager.php | 6 ++++- .../LoaderPluginManagerFactoryTest.php | 26 ++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Translator/LoaderPluginManager.php b/src/Translator/LoaderPluginManager.php index 83714beb..2d46e2d3 100644 --- a/src/Translator/LoaderPluginManager.php +++ b/src/Translator/LoaderPluginManager.php @@ -58,8 +58,12 @@ class LoaderPluginManager extends AbstractPluginManager { protected $aliases = [ 'gettext' => Loader\Gettext::class, + 'getText' => Loader\Gettext::class, + 'GetText' => Loader\Gettext::class, 'ini' => Loader\Ini::class, - 'phparray' => Loader\PhpArray::class + 'phparray' => Loader\PhpArray::class, + 'phpArray' => Loader\PhpArray::class, + 'PhpArray' => Loader\PhpArray::class, ]; protected $factories = [ diff --git a/test/Translator/LoaderPluginManagerFactoryTest.php b/test/Translator/LoaderPluginManagerFactoryTest.php index d854c9ab..485100d5 100644 --- a/test/Translator/LoaderPluginManagerFactoryTest.php +++ b/test/Translator/LoaderPluginManagerFactoryTest.php @@ -36,26 +36,44 @@ public function testCreateServiceReturnsUnconfiguredPluginManagerWhenNoOptionsPr $this->assertFalse($loaders->has('test')); } - public function testFactoryCanConfigurePluginManagerViaOptions() + public function provideLoader() + { + return [ + ['gettext'], + ['getText'], + ['GetText'], + ['phparray'], + ['phpArray'], + ['PhpArray'], + ]; + } + + /** + * @dataProvider provideLoader + */ + public function testFactoryCanConfigurePluginManagerViaOptions($loader) { $container = $this->prophesize(ContainerInterface::class)->reveal(); $factory = new LoaderPluginManagerFactory(); $loaders = $factory($container, 'TranslatorPluginManager', ['aliases' => [ - 'test' => 'phparray', + 'test' => $loader, ]]); $this->assertInstanceOf(LoaderPluginManager::class, $loaders); $this->assertTrue($loaders->has('test')); } - public function testCreateServiceCanConfigurePluginManagerViaOptions() + /** + * @dataProvider provideLoader + */ + public function testCreateServiceCanConfigurePluginManagerViaOptions($loader) { $container = $this->prophesize(ServiceLocatorInterface::class); $container->willImplement(ContainerInterface::class); $factory = new LoaderPluginManagerFactory(); $factory->setCreationOptions(['aliases' => [ - 'test' => 'phparray', + 'test' => $loader, ]]); $loaders = $factory->createService($container->reveal()); $this->assertInstanceOf(LoaderPluginManager::class, $loaders); From ea9adcfc7b79681dfda6f7f72d6467615f752bc7 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 17 May 2017 11:49:04 -0500 Subject: [PATCH 2/2] Added CHANGELOG for #56 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed2baf2..5587fd3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file, in reverse and thus seeding it with configured translator loader services. This means that the `translator_plugins` configuration will now be honored in non-zend-mvc contexts. +- [#56](https://github.com/zendframework/zend-i18n/pull/56) adds more aliases to + the `LoaderPluginManager` to ensure different cAsIng strategies will still + resolve translation loaders under zend-servicemanager v3. ## 2.7.3 - 2016-06-07