@@ 44-53 (lines=10) @@ | ||
41 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Query\QueryModifier'); |
|
42 | } |
|
43 | ||
44 | public function it_indexes_with_default_dql_alias(QueryBuilder $qb) |
|
45 | { |
|
46 | if (!method_exists(QueryBuilder::class, 'indexBy')) { |
|
47 | throw new SkippingException('IndexBy query modifier require doctrine/orm >= 2.5'); |
|
48 | } |
|
49 | ||
50 | $this->beConstructedWith('something', 'x'); |
|
51 | $qb->indexBy('x', 'x.something')->shouldBeCalled(); |
|
52 | $this->modify($qb, 'a'); |
|
53 | } |
|
54 | ||
55 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
56 | { |
|
@@ 55-64 (lines=10) @@ | ||
52 | $this->modify($qb, 'a'); |
|
53 | } |
|
54 | ||
55 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
56 | { |
|
57 | if (!method_exists(QueryBuilder::class, 'indexBy')) { |
|
58 | throw new SkippingException('IndexBy query modifier require doctrine/orm >= 2.5'); |
|
59 | } |
|
60 | ||
61 | $this->beConstructedWith('thing'); |
|
62 | $qb->indexBy('b', 'b.thing')->shouldBeCalled(); |
|
63 | $this->modify($qb, 'b'); |
|
64 | } |
|
65 | } |
|
66 |