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

Commit

Permalink
Merge branch 'hotfix/56'
Browse files Browse the repository at this point in the history
Close #56
  • Loading branch information
weierophinney committed May 17, 2017
2 parents bdaa961 + ea9adcf commit bb9c5cc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/Translator/LoaderPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
26 changes: 22 additions & 4 deletions test/Translator/LoaderPluginManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,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);
Expand Down

0 comments on commit bb9c5cc

Please sign in to comment.