|
@@ 64-78 (lines=15) @@
|
| 61 |
|
$this->match($specification); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
public function it_should_apply_filter( |
| 65 |
|
Filter $specification, |
| 66 |
|
EntityManager $entityManager, |
| 67 |
|
QueryBuilder $qb, |
| 68 |
|
AbstractQuery $query |
| 69 |
|
) { |
| 70 |
|
$this->prepareEntityManagerStub($entityManager, $qb); |
| 71 |
|
$this->prepareQueryBuilderStub($qb, $query); |
| 72 |
|
$specification->getFilter($qb, $this->alias)->willReturn($this->expression); |
| 73 |
|
|
| 74 |
|
$qb->andWhere($this->expression)->willReturn($qb); |
| 75 |
|
$qb->where()->shouldNotBeCalled(); |
| 76 |
|
|
| 77 |
|
$this->match($specification); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function it_should_skip_apply_empty_specification( |
| 81 |
|
EntityManager $entityManager, |
|
@@ 280-294 (lines=15) @@
|
| 277 |
|
$this->shouldThrow(UnexpectedResultException::class)->duringMatchOneOrNullResult($specification); |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
public function it_matches_a_specification_with_result_modifier( |
| 281 |
|
Specification $specification, |
| 282 |
|
EntityManager $entityManager, |
| 283 |
|
QueryBuilder $qb, |
| 284 |
|
AbstractQuery $query, |
| 285 |
|
ResultModifier $modifier |
| 286 |
|
) { |
| 287 |
|
$this->prepareStubs($specification, $entityManager, $qb, $query); |
| 288 |
|
$query->execute()->willReturn($this->result); |
| 289 |
|
|
| 290 |
|
$specification->modify($qb, $this->alias)->shouldBeCalled(); |
| 291 |
|
$modifier->modify($query)->shouldBeCalled(); |
| 292 |
|
|
| 293 |
|
$this->match($specification, $modifier)->shouldReturn($this->result); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
private function prepareStubs(Specification $specification, EntityManager $entityManager, QueryBuilder $qb, AbstractQuery $query) |
| 297 |
|
{ |