Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Hydration / CustomHydratorTest.php
diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php
new file mode 100644 (file)
index 0000000..09be6bc
--- /dev/null
@@ -0,0 +1,29 @@
+<?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);
+    }
+}
\ No newline at end of file