function it_matches_a_specification_with_result_modifier(Specification $specification, EntityManager $entityManager, QueryBuilder $qb, AbstractQuery $query, ResultModifier $modifier)
 {
     $this->prepareStubs($specification, $entityManager, $qb, $query);
     $query->execute()->willReturn($this->result);
     $specification->modify($qb, $this->alias)->shouldBeCalled();
     $modifier->modify($query)->shouldBeCalled();
     $this->match($specification, $modifier)->shouldReturn($this->result);
 }
 /**
  * Prepare a Query with a Specification.
  *
  * @param Filter|QueryModifier  $specification
  * @param Result\ResultModifier $modifier
  *
  * @return \Doctrine\ORM\Query
  */
 public function getQuery($specification, Result\ResultModifier $modifier = null)
 {
     $qb = $this->createQueryBuilder($this->alias);
     $this->applySpecification($qb, $specification);
     $query = $qb->getQuery();
     if ($modifier !== null) {
         $modifier->modify($query);
     }
     return $query;
 }
 /**
  * Prepare a Query with a Specification.
  *
  * @param Specification         $specification
  * @param Result\ResultModifier $modifier
  *
  * @return \Doctrine\ORM\Query
  */
 public function getQuery(Specification $specification, Result\ResultModifier $modifier = null)
 {
     $alias = $this->alias;
     $qb = $this->createQueryBuilder($alias);
     $specification->modify($qb, $alias);
     $query = $qb->where($specification->getFilter($qb, $alias))->getQuery();
     if ($modifier !== null) {
         $modifier->modify($query);
         return $query;
     }
     return $query;
 }