From 8b4b8e7268a147a7e17f65d2e461ff458d031776 Mon Sep 17 00:00:00 2001 From: Justin Martin Date: Wed, 6 Nov 2013 18:44:51 -0800 Subject: [PATCH] Test EntityManager::createNamedQuery. Test EntityManager::createNamedNativeQuery. --- .../Doctrine/Tests/ORM/EntityManagerTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index 7de921359..a21fbfad6 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -62,6 +62,19 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase $this->assertSame('SELECT foo', $query->getSql()); } + /** + * @covers Doctrine\ORM\EntityManager::createNamedNativeQuery + */ + public function testCreateNamedNativeQuery() + { + $rsm = new \Doctrine\ORM\Query\ResultSetMapping(); + $this->_em->getConfiguration()->addNamedNativeQuery('foo', 'SELECT foo', $rsm); + + $query = $this->_em->createNamedNativeQuery('foo'); + + $this->assertInstanceOf('Doctrine\ORM\NativeQuery', $query); + } + public function testCreateQueryBuilder() { $this->assertInstanceOf('Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder()); @@ -100,6 +113,18 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase $this->assertInstanceOf('Doctrine\ORM\Query', $q); $this->assertEquals('SELECT 1', $q->getDql()); } + + /** + * @covers Doctrine\ORM\EntityManager::createNamedQuery + */ + public function testCreateNamedQuery() + { + $this->_em->getConfiguration()->addNamedQuery('foo', 'SELECT 1'); + + $query = $this->_em->createNamedQuery('foo'); + $this->assertInstanceOf('Doctrine\ORM\Query', $query); + $this->assertEquals('SELECT 1', $query->getDql()); + } static public function dataMethodsAffectedByNoObjectArguments() {