Remove builders from QueryExpressionVisitorTest constructor
This commit is contained in:
parent
2aba7fb374
commit
a162f00ecc
@ -41,23 +41,6 @@ class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase
|
|||||||
* @var QueryExpressionVisitor
|
* @var QueryExpressionVisitor
|
||||||
*/
|
*/
|
||||||
private $visitor;
|
private $visitor;
|
||||||
/**
|
|
||||||
* @var CriteriaBuilder
|
|
||||||
*/
|
|
||||||
private $criteriaBuilder;
|
|
||||||
/**
|
|
||||||
* @var QueryBuilder
|
|
||||||
*/
|
|
||||||
private $queryBuilder;
|
|
||||||
|
|
||||||
public function __construct($name = NULL, array $data = array(), $dataName = '')
|
|
||||||
{
|
|
||||||
$this->criteriaBuilder = new CriteriaBuilder();
|
|
||||||
$this->queryBuilder = new QueryBuilder();
|
|
||||||
|
|
||||||
parent::__construct($name, $data, $dataName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
@ -84,32 +67,36 @@ class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function comparisonData()
|
public function comparisonData()
|
||||||
{
|
{
|
||||||
|
$cb = new CriteriaBuilder();
|
||||||
|
$qb = new QueryBuilder();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array($this->criteriaBuilder->eq('field', 'value'), $this->queryBuilder->eq('field', ':field'), new Parameter('field', 'value')),
|
array($cb->eq('field', 'value'), $qb->eq('field', ':field'), new Parameter('field', 'value')),
|
||||||
array($this->criteriaBuilder->neq('field', 'value'), $this->queryBuilder->neq('field', ':field'), new Parameter('field', 'value')),
|
array($cb->neq('field', 'value'), $qb->neq('field', ':field'), new Parameter('field', 'value')),
|
||||||
array($this->criteriaBuilder->eq('field', null), $this->queryBuilder->isNull('field')),
|
array($cb->eq('field', null), $qb->isNull('field')),
|
||||||
array($this->criteriaBuilder->neq('field', null), $this->queryBuilder->isNotNull('field')),
|
array($cb->neq('field', null), $qb->isNotNull('field')),
|
||||||
array($this->criteriaBuilder->isNull('field'), $this->queryBuilder->isNull('field')),
|
array($cb->isNull('field'), $qb->isNull('field')),
|
||||||
|
|
||||||
array($this->criteriaBuilder->gt('field', 'value'), $this->queryBuilder->gt('field', ':field'), new Parameter('field', 'value')),
|
array($cb->gt('field', 'value'), $qb->gt('field', ':field'), new Parameter('field', 'value')),
|
||||||
array($this->criteriaBuilder->gte('field', 'value'), $this->queryBuilder->gte('field', ':field'), new Parameter('field', 'value')),
|
array($cb->gte('field', 'value'), $qb->gte('field', ':field'), new Parameter('field', 'value')),
|
||||||
array($this->criteriaBuilder->lt('field', 'value'), $this->queryBuilder->lt('field', ':field'), new Parameter('field', 'value')),
|
array($cb->lt('field', 'value'), $qb->lt('field', ':field'), new Parameter('field', 'value')),
|
||||||
array($this->criteriaBuilder->lte('field', 'value'), $this->queryBuilder->lte('field', ':field'), new Parameter('field', 'value')),
|
array($cb->lte('field', 'value'), $qb->lte('field', ':field'), new Parameter('field', 'value')),
|
||||||
|
|
||||||
array($this->criteriaBuilder->in('field', array('value')), $this->queryBuilder->in('field', ':field'), new Parameter('field', array('value'))),
|
array($cb->in('field', array('value')), $qb->in('field', ':field'), new Parameter('field', array('value'))),
|
||||||
array($this->criteriaBuilder->notIn('field', array('value')), $this->queryBuilder->notIn('field', ':field'), new Parameter('field', array('value'))),
|
array($cb->notIn('field', array('value')), $qb->notIn('field', ':field'), new Parameter('field', array('value'))),
|
||||||
|
|
||||||
// Test parameter conversion
|
// Test parameter conversion
|
||||||
array($this->criteriaBuilder->eq('object.field', 'value'), $this->queryBuilder->eq('object.field', ':object_field'), new Parameter('object_field', 'value')),
|
array($cb->eq('object.field', 'value'), $qb->eq('object.field', ':object_field'), new Parameter('object_field', 'value')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWalkAndCompositeExpression()
|
public function testWalkAndCompositeExpression()
|
||||||
{
|
{
|
||||||
|
$cb = new CriteriaBuilder();
|
||||||
$expr = $this->visitor->walkCompositeExpression(
|
$expr = $this->visitor->walkCompositeExpression(
|
||||||
$this->criteriaBuilder->andX(
|
$cb->andX(
|
||||||
$this->criteriaBuilder->eq("foo", 1),
|
$cb->eq("foo", 1),
|
||||||
$this->criteriaBuilder->eq("bar", 1)
|
$cb->eq("bar", 1)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -119,10 +106,11 @@ class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testWalkOrCompositeExpression()
|
public function testWalkOrCompositeExpression()
|
||||||
{
|
{
|
||||||
|
$cb = new CriteriaBuilder();
|
||||||
$expr = $this->visitor->walkCompositeExpression(
|
$expr = $this->visitor->walkCompositeExpression(
|
||||||
$this->criteriaBuilder->orX(
|
$cb->orX(
|
||||||
$this->criteriaBuilder->eq("foo", 1),
|
$cb->eq("foo", 1),
|
||||||
$this->criteriaBuilder->eq("bar", 1)
|
$cb->eq("bar", 1)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user