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