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

hotfix/#7142: AbstractConfigFactory now returns requested config array #7144

Merged
merged 1 commit into from
Jan 22, 2015
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
2 changes: 1 addition & 1 deletion library/Zend/Config/AbstractConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function createServiceWithName(ServiceManager\ServiceLocatorInterface $se

$config = $serviceLocator->get('Config');
$this->configs[$requestedName] = $this->configs[$key] = $config[$key];
return $config;
return $config[$key];
}

/**
Expand Down
20 changes: 18 additions & 2 deletions tests/ZendTest/Config/AbstractConfigFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
*/
class AbstractConfigFactoryTest extends \PHPUnit_Framework_TestCase
{
/**
* @var array
*/
protected $config;

/**
* @var \Zend\Mvc\Application
*/
Expand All @@ -35,7 +40,7 @@ class AbstractConfigFactoryTest extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
$config = array(
$this->config = array(
'MyModule' => array(
'foo' => array(
'bar'
Expand All @@ -56,7 +61,7 @@ public function setUp()
))
);

$sm->setService('Config', $config);
$sm->setService('Config', $this->config);
}

/**
Expand Down Expand Up @@ -131,4 +136,15 @@ public function testCreateService()
$this->assertInternalType('array', $serviceLocator->get('phly-blog-config'));
$this->assertInternalType('array', $serviceLocator->get('config-phly-blog'));
}

/**
* @depends testCreateService
* @return void
*/
public function testCreateServiceWithRequestedConfigKey()
{
$serviceLocator = $this->serviceManager;
$this->assertSame($this->config['MyModule'], $serviceLocator->get('MyModule\Config'));
$this->assertSame($this->config['phly-blog'], $serviceLocator->get('phly-blog-config'));
}
}