1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php
2011-11-03 02:37:54 -02:00

29 lines
843 B
PHP

<?php
namespace Doctrine\Tests\ORM\Hydration;
use PDO, Doctrine\ORM\Internal\Hydration\AbstractHydrator;
require_once __DIR__ . '/../../TestInit.php';
class CustomHydratorTest extends HydrationTestCase
{
public function testCustomHydrator()
{
$em = $this->_getTestEntityManager();
$config = $em->getConfiguration();
$config->addCustomHydrationMode('CustomHydrator', 'Doctrine\Tests\ORM\Hydration\CustomHydrator');
$hydrator = $em->newHydrator('CustomHydrator');
$this->assertInstanceOf('Doctrine\Tests\ORM\Hydration\CustomHydrator', $hydrator);
$this->assertNull($config->getCustomHydrationMode('does not exist'));
}
}
class CustomHydrator extends AbstractHydrator
{
protected function hydrateAllData()
{
return $this->_stmt->fetchAll(PDO::FETCH_ASSOC);
}
}