function it_should_apply_filter(Filter $specification, EntityManager $entityManager, QueryBuilder $qb, AbstractQuery $query) { $this->prepareEntityManagerStub($entityManager, $qb); $this->prepareQueryBuilderStub($qb, $query); $specification->getFilter($qb, $this->alias)->willReturn($this->expression); $qb->andWhere($this->expression)->willReturn($qb); $qb->where()->shouldNotBeCalled(); $this->match($specification); }
function it_supports_expressions(QueryBuilder $qb, Expr $expression, Filter $exprA, Filter $exprB, $x, $y) { $this->beConstructedWith(self::EXPRESSION, array($exprA, $exprB)); $dqlAlias = 'a'; $exprA->getFilter($qb, $dqlAlias)->willReturn($x); $exprB->getFilter($qb, $dqlAlias)->willReturn($y); $qb->expr()->willReturn($expression); $expression->{self::EXPRESSION}($x, $y)->shouldBeCalled(); $this->getFilter($qb, $dqlAlias); }
/** * calls parent */ function it_calls_parent_match(QueryBuilder $qb, Expr $expr, Filter $filterExpr) { $dqlAlias = 'a'; $expression = 'expression'; $parentExpression = 'foobar'; $qb->expr()->willReturn($expr); $filterExpr->getFilter($qb, $dqlAlias)->willReturn($parentExpression); $expr->not($parentExpression)->willReturn($expression); $this->getFilter($qb, $dqlAlias)->shouldReturn($expression); }