diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index 9a0de4bd2..c753960f8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -128,6 +128,13 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $user = $q->getSingleResult(); } + public function testSetParameters() + { + $q = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = ?1 AND u.status = ?2'); + $q->setParameters(array(1 => 'jwage', 2 => 'active')); + $users = $q->getResult(); + } + public function testIterateResult_IterativelyBuildUpUnitOfWork() { $article1 = new CmsArticle; @@ -175,26 +182,6 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $query = $this->_em->createQuery("SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.articles a"); $articles = $query->iterate(); } - - public function testFluentQueryInterface() - { - $q = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a"); - $q2 = $q->expireQueryCache(true) - ->setQueryCacheLifetime(3600) - ->setQueryCacheDriver(null) - ->expireResultCache(true) - ->setHint('foo', 'bar') - ->setHint('bar', 'baz') - ->setParameter(1, 'bar') - ->setParameters(array(2 => 'baz')) - ->setResultCacheDriver(null) - ->setResultCacheId('foo') - ->setDql('foo') - ->setFirstResult(10) - ->setMaxResults(10); - - $this->assertSame($q2, $q); - } /** * @expectedException Doctrine\ORM\NoResultException diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 514c9d81c..98458c6bd 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -35,6 +35,13 @@ class QueryTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals(array(2 => 84), $query->getParameters()); } + public function testSetParameters() + { + $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1"); + $query->setParameters(array(1 => 'foo', 2 => 'bar')); + $this->assertEquals(array(1 => 'foo', 2 => 'bar'), $query->getParameters()); + } + public function testFree() { $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1"); @@ -59,4 +66,24 @@ class QueryTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals(array(), $cloned->getParameters()); $this->assertFalse($cloned->getHint('foo')); } + + public function testFluentQueryInterface() + { + $q = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a"); + $q2 = $q->expireQueryCache(true) + ->setQueryCacheLifetime(3600) + ->setQueryCacheDriver(null) + ->expireResultCache(true) + ->setHint('foo', 'bar') + ->setHint('bar', 'baz') + ->setParameter(1, 'bar') + ->setParameters(array(2 => 'baz')) + ->setResultCacheDriver(null) + ->setResultCacheId('foo') + ->setDql('foo') + ->setFirstResult(10) + ->setMaxResults(10); + + $this->assertSame($q2, $q); + } } \ No newline at end of file