@@ 12-36 (lines=25) @@ | ||
9 | /** |
|
10 | * @mixin InnerJoin |
|
11 | */ |
|
12 | class InnerJoinSpec extends ObjectBehavior |
|
13 | { |
|
14 | public function let() |
|
15 | { |
|
16 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
17 | } |
|
18 | ||
19 | public function it_is_a_specification() |
|
20 | { |
|
21 | $this->shouldHaveType('Happyr\DoctrineSpecification\Query\QueryModifier'); |
|
22 | } |
|
23 | ||
24 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
25 | { |
|
26 | $qb->innerJoin('a.user', 'authUser')->shouldBeCalled(); |
|
27 | $this->modify($qb, 'a'); |
|
28 | } |
|
29 | ||
30 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
31 | { |
|
32 | $this->beConstructedWith('user', 'authUser'); |
|
33 | $qb->innerJoin('b.user', 'authUser')->shouldBeCalled(); |
|
34 | $this->modify($qb, 'b'); |
|
35 | } |
|
36 | } |
|
37 |
@@ 12-36 (lines=25) @@ | ||
9 | /** |
|
10 | * @mixin Join |
|
11 | */ |
|
12 | class JoinSpec extends ObjectBehavior |
|
13 | { |
|
14 | public function let() |
|
15 | { |
|
16 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
17 | } |
|
18 | ||
19 | public function it_is_a_specification() |
|
20 | { |
|
21 | $this->shouldHaveType('Happyr\DoctrineSpecification\Query\QueryModifier'); |
|
22 | } |
|
23 | ||
24 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
25 | { |
|
26 | $qb->join('a.user', 'authUser')->shouldBeCalled(); |
|
27 | $this->modify($qb, 'a'); |
|
28 | } |
|
29 | ||
30 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
31 | { |
|
32 | $this->beConstructedWith('user', 'authUser'); |
|
33 | $qb->join('b.user', 'authUser')->shouldBeCalled(); |
|
34 | $this->modify($qb, 'b'); |
|
35 | } |
|
36 | } |
|
37 |
@@ 12-36 (lines=25) @@ | ||
9 | /** |
|
10 | * @mixin LeftJoin |
|
11 | */ |
|
12 | class LeftJoinSpec extends ObjectBehavior |
|
13 | { |
|
14 | public function let() |
|
15 | { |
|
16 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
17 | } |
|
18 | ||
19 | public function it_is_a_specification() |
|
20 | { |
|
21 | $this->shouldHaveType('Happyr\DoctrineSpecification\Query\QueryModifier'); |
|
22 | } |
|
23 | ||
24 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
25 | { |
|
26 | $qb->leftJoin('a.user', 'authUser')->shouldBeCalled(); |
|
27 | $this->modify($qb, 'a'); |
|
28 | } |
|
29 | ||
30 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
31 | { |
|
32 | $this->beConstructedWith('user', 'authUser'); |
|
33 | $qb->leftJoin('b.user', 'authUser')->shouldBeCalled(); |
|
34 | $this->modify($qb, 'b'); |
|
35 | } |
|
36 | } |
|
37 |