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

add more aliases at LoaderPluginManager #56

Merged
merged 1 commit into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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);
Expand Down