@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin Equals |
|
25 | */ |
|
26 | class EqualsSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age = :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age = :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |
@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin GreaterOrEqualThan |
|
25 | */ |
|
26 | class GreaterOrEqualThanSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age >= :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age >= :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |
@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin GreaterThan |
|
25 | */ |
|
26 | class GreaterThanSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age > :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age > :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |
@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin LessOrEqualThan |
|
25 | */ |
|
26 | class LessOrEqualThanSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age <= :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age <= :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |
@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin LessThan |
|
25 | */ |
|
26 | class LessThanSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age < :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age < :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |
@@ 26-61 (lines=36) @@ | ||
23 | /** |
|
24 | * @mixin NotEquals |
|
25 | */ |
|
26 | class NotEqualsSpec extends ObjectBehavior |
|
27 | { |
|
28 | public function let() |
|
29 | { |
|
30 | $this->beConstructedWith('age', 18, 'a'); |
|
31 | } |
|
32 | ||
33 | public function it_is_an_expression() |
|
34 | { |
|
35 | $this->shouldBeAnInstanceOf(Filter::class); |
|
36 | } |
|
37 | ||
38 | public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $parameters) |
|
39 | { |
|
40 | $qb->getParameters()->willReturn($parameters); |
|
41 | $parameters->count()->willReturn(10); |
|
42 | ||
43 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
44 | ||
45 | $comparison = $this->getFilter($qb, null); |
|
46 | ||
47 | $comparison->shouldReturn('a.age <> :comparison_10'); |
|
48 | } |
|
49 | ||
50 | public function it_uses_comparison_specific_dql_alias_if_passed(QueryBuilder $qb, ArrayCollection $parameters) |
|
51 | { |
|
52 | $this->beConstructedWith('age', 18, null); |
|
53 | ||
54 | $qb->getParameters()->willReturn($parameters); |
|
55 | $parameters->count()->willReturn(10); |
|
56 | ||
57 | $qb->setParameter('comparison_10', 18, null)->shouldBeCalled(); |
|
58 | ||
59 | $this->getFilter($qb, 'x')->shouldReturn('x.age <> :comparison_10'); |
|
60 | } |
|
61 | } |
|
62 |