| @@ 24-48 (lines=25) @@ | ||
| 21 | /** |
|
| 22 | * @mixin InnerJoin |
|
| 23 | */ |
|
| 24 | class InnerJoinSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | public function let() |
|
| 27 | { |
|
| 28 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_is_a_specification() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(QueryModifier::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
| 37 | { |
|
| 38 | $qb->innerJoin('a.user', 'authUser')->shouldBeCalled(); |
|
| 39 | $this->modify($qb, 'a'); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
| 43 | { |
|
| 44 | $this->beConstructedWith('user', 'authUser'); |
|
| 45 | $qb->innerJoin('b.user', 'authUser')->shouldBeCalled(); |
|
| 46 | $this->modify($qb, 'b'); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 24-48 (lines=25) @@ | ||
| 21 | /** |
|
| 22 | * @mixin Join |
|
| 23 | */ |
|
| 24 | class JoinSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | public function let() |
|
| 27 | { |
|
| 28 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_is_a_specification() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(QueryModifier::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
| 37 | { |
|
| 38 | $qb->join('a.user', 'authUser')->shouldBeCalled(); |
|
| 39 | $this->modify($qb, 'a'); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
| 43 | { |
|
| 44 | $this->beConstructedWith('user', 'authUser'); |
|
| 45 | $qb->join('b.user', 'authUser')->shouldBeCalled(); |
|
| 46 | $this->modify($qb, 'b'); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 24-48 (lines=25) @@ | ||
| 21 | /** |
|
| 22 | * @mixin LeftJoin |
|
| 23 | */ |
|
| 24 | class LeftJoinSpec extends ObjectBehavior |
|
| 25 | { |
|
| 26 | public function let() |
|
| 27 | { |
|
| 28 | $this->beConstructedWith('user', 'authUser', 'a'); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_is_a_specification() |
|
| 32 | { |
|
| 33 | $this->shouldHaveType(QueryModifier::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function it_joins_with_default_dql_alias(QueryBuilder $qb) |
|
| 37 | { |
|
| 38 | $qb->leftJoin('a.user', 'authUser')->shouldBeCalled(); |
|
| 39 | $this->modify($qb, 'a'); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function it_uses_local_alias_if_global_was_not_set(QueryBuilder $qb) |
|
| 43 | { |
|
| 44 | $this->beConstructedWith('user', 'authUser'); |
|
| 45 | $qb->leftJoin('b.user', 'authUser')->shouldBeCalled(); |
|
| 46 | $this->modify($qb, 'b'); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||