|
@@ 43-54 (lines=12) @@
|
| 40 |
|
$this->shouldBeAnInstanceOf(Filter::class); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
public function it_surrounds_with_wildcards_when_using_contains( |
| 44 |
|
QueryBuilder $qb, |
| 45 |
|
ArrayCollection $parameters |
| 46 |
|
): void { |
| 47 |
|
$this->beConstructedWith($this->field, $this->value, Like::CONTAINS, 'context'); |
| 48 |
|
$qb->getParameters()->willReturn($parameters); |
| 49 |
|
$parameters->count()->willReturn(1); |
| 50 |
|
|
| 51 |
|
$qb->setParameter('comparison_1', '%bar%')->shouldBeCalled(); |
| 52 |
|
|
| 53 |
|
$this->getFilter($qb, 'a'); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public function it_starts_with_wildcard_when_using_ends_with(QueryBuilder $qb, ArrayCollection $parameters): void |
| 57 |
|
{ |
|
@@ 56-65 (lines=10) @@
|
| 53 |
|
$this->getFilter($qb, 'a'); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public function it_starts_with_wildcard_when_using_ends_with(QueryBuilder $qb, ArrayCollection $parameters): void |
| 57 |
|
{ |
| 58 |
|
$this->beConstructedWith($this->field, $this->value, Like::ENDS_WITH, 'context'); |
| 59 |
|
$qb->getParameters()->willReturn($parameters); |
| 60 |
|
$parameters->count()->willReturn(1); |
| 61 |
|
|
| 62 |
|
$qb->setParameter('comparison_1', '%bar')->shouldBeCalled(); |
| 63 |
|
|
| 64 |
|
$this->getFilter($qb, 'a'); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function it_ends_with_wildcard_when_using_starts_with(QueryBuilder $qb, ArrayCollection $parameters): void |
| 68 |
|
{ |
|
@@ 67-76 (lines=10) @@
|
| 64 |
|
$this->getFilter($qb, 'a'); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function it_ends_with_wildcard_when_using_starts_with(QueryBuilder $qb, ArrayCollection $parameters): void |
| 68 |
|
{ |
| 69 |
|
$this->beConstructedWith($this->field, $this->value, Like::STARTS_WITH, 'context'); |
| 70 |
|
$qb->getParameters()->willReturn($parameters); |
| 71 |
|
$parameters->count()->willReturn(1); |
| 72 |
|
|
| 73 |
|
$qb->setParameter('comparison_1', 'bar%')->shouldBeCalled(); |
| 74 |
|
|
| 75 |
|
$this->getFilter($qb, 'a'); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function it_filter_array_collection_starts_with(): void |
| 79 |
|
{ |