public function testCompileMultipleComposites()
 {
     $predicate = new LiteralPredicate('bacon');
     $predicate = $predicate->andPredicate(new LiteralPredicate('eggs'));
     $predicate = $predicate->orPredicate(new LiteralPredicate('steak'));
     $compiler = new QueryPredicateVisitor();
     $this->assertEquals('((bacon AND eggs) OR steak)', $compiler->compile($predicate));
     $predicate = new LiteralPredicate('bacon');
     $predicate = $predicate->orPredicate(new LiteralPredicate('eggs'));
     $predicate = $predicate->andPredicate(new LiteralPredicate('steak'));
     $this->assertEquals('((bacon OR eggs) AND steak)', $compiler->compile($predicate));
 }
 private function buildQueryTerm()
 {
     if (!$this->conditionBuilder) {
         return $this->query;
     }
     $compiler = new QueryPredicateVisitor();
     $this->conditionBuilder->endAllGroups();
     $this->conditionBuilder->andWhere($this->query);
     return $compiler->compile($this->conditionBuilder->getPredicate());
 }
 private function assertQuery($expected, PredicateBuilder $builder)
 {
     $compiler = new QueryPredicateVisitor();
     $this->assertEquals($expected, $compiler->compile($builder->getPredicate()));
 }