1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Fix setCustomHydrationModes + added test

This commit is contained in:
Alexander 2012-08-14 22:43:32 +02:00
parent 5c585b4c02
commit 185b4e0c41
2 changed files with 16 additions and 1 deletions

View File

@ -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);

View File

@ -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());