Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Hydration / CustomHydratorTest.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Hydration;
4
5 use PDO, Doctrine\ORM\Internal\Hydration\AbstractHydrator;
6
7 require_once __DIR__ . '/../../TestInit.php';
8
9 class CustomHydratorTest extends HydrationTestCase
10 {
11     public function testCustomHydrator()
12     {
13         $em = $this->_getTestEntityManager();
14         $config = $em->getConfiguration();
15         $config->addCustomHydrationMode('CustomHydrator', 'Doctrine\Tests\ORM\Hydration\CustomHydrator');
16
17         $hydrator = $em->newHydrator('CustomHydrator');
18         $this->assertInstanceOf('Doctrine\Tests\ORM\Hydration\CustomHydrator', $hydrator);
19         $this->assertNull($config->getCustomHydrationMode('does not exist'));
20     }
21 }
22
23 class CustomHydrator extends AbstractHydrator
24 {
25     protected function hydrateAllData()
26     {
27         return $this->_stmt->fetchAll(PDO::FETCH_ASSOC);
28     }
29 }