Adding tests that confirm that DDC-2844 is fixed
This commit is contained in:
parent
8a38534be4
commit
72e6de9417
@ -422,6 +422,40 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertNotNull($qb->getParameter('field_1'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-2844
|
||||
*/
|
||||
public function testAddCriteriaWhereWithMultipleParametersWithSameField()
|
||||
{
|
||||
$qb = $this->_em->createQueryBuilder();
|
||||
$criteria = new Criteria();
|
||||
$criteria->where($criteria->expr()->eq('field', 'value1'));
|
||||
$criteria->andWhere($criteria->expr()->gt('field', 'value2'));
|
||||
|
||||
$qb->addCriteria($criteria);
|
||||
|
||||
$this->assertEquals('field = :field AND field > :field_1', (string) $qb->getDQLPart('where'));
|
||||
$this->assertSame('value1', $qb->getParameter('field')->getValue());
|
||||
$this->assertSame('value2', $qb->getParameter('field_1')->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-2844
|
||||
*/
|
||||
public function testAddCriteriaWhereWithMultipleParametersWithDifferentFields()
|
||||
{
|
||||
$qb = $this->_em->createQueryBuilder();
|
||||
$criteria = new Criteria();
|
||||
$criteria->where($criteria->expr()->eq('field1', 'value1'));
|
||||
$criteria->andWhere($criteria->expr()->gt('field2', 'value2'));
|
||||
|
||||
$qb->addCriteria($criteria);
|
||||
|
||||
$this->assertEquals('field1 = :field1 AND field2 > :field2', (string) $qb->getDQLPart('where'));
|
||||
$this->assertSame('value1', $qb->getParameter('field1')->getValue());
|
||||
$this->assertSame('value2', $qb->getParameter('field2')->getValue());
|
||||
}
|
||||
|
||||
public function testAddCriteriaOrder()
|
||||
{
|
||||
$qb = $this->_em->createQueryBuilder();
|
||||
|
Loading…
x
Reference in New Issue
Block a user