Fix setCustomHydrationModes + added test
This commit is contained in:
parent
5c585b4c02
commit
185b4e0c41
@ -519,7 +519,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
|||||||
*/
|
*/
|
||||||
public function setCustomHydrationModes($modes)
|
public function setCustomHydrationModes($modes)
|
||||||
{
|
{
|
||||||
$this->_attributes['customHydrationMods'] = array();
|
$this->_attributes['customHydrationModes'] = array();
|
||||||
|
|
||||||
foreach ($modes as $modeName => $hydrator) {
|
foreach ($modes as $modeName => $hydrator) {
|
||||||
$this->addCustomHydrationMode($modeName, $hydrator);
|
$this->addCustomHydrationMode($modeName, $hydrator);
|
||||||
|
@ -206,6 +206,21 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('HydrationModeName'));
|
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('HydrationModeName'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetCustomHydrationModes()
|
||||||
|
{
|
||||||
|
$this->configuration->addCustomHydrationMode('HydrationModeName', __CLASS__);
|
||||||
|
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('HydrationModeName'));
|
||||||
|
|
||||||
|
$this->configuration->setCustomHydrationModes(
|
||||||
|
array(
|
||||||
|
'AnotherHydrationModeName' => __CLASS__
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNull($this->configuration->getCustomHydrationMode('HydrationModeName'));
|
||||||
|
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('AnotherHydrationModeName'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetGetClassMetadataFactoryName()
|
public function testSetGetClassMetadataFactoryName()
|
||||||
{
|
{
|
||||||
$this->assertSame('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->configuration->getClassMetadataFactoryName());
|
$this->assertSame('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->configuration->getClassMetadataFactoryName());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user