| @@ 13-36 (lines=24) @@ | ||
| 10 | /** | |
| 11 | * @mixin Alias | |
| 12 | */ | |
| 13 | class AliasSpec extends ObjectBehavior | |
| 14 | { | |
| 15 | private $alias = 'foo'; | |
| 16 | ||
| 17 | public function let() | |
| 18 |     { | |
| 19 | $this->beConstructedWith($this->alias); | |
| 20 | } | |
| 21 | ||
| 22 | public function it_is_a_alias() | |
| 23 |     { | |
| 24 | $this->shouldBeAnInstanceOf(Alias::class); | |
| 25 | } | |
| 26 | ||
| 27 | public function it_is_a_operand() | |
| 28 |     { | |
| 29 | $this->shouldBeAnInstanceOf(Operand::class); | |
| 30 | } | |
| 31 | ||
| 32 | public function it_is_transformable(QueryBuilder $qb) | |
| 33 |     { | |
| 34 | $this->transform($qb, 'a')->shouldReturn($this->alias); | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| @@ 13-36 (lines=24) @@ | ||
| 10 | /** | |
| 11 | * @mixin CountDistinct | |
| 12 | */ | |
| 13 | class CountDistinctSpec extends ObjectBehavior | |
| 14 | { | |
| 15 | private $field = 'foo'; | |
| 16 | ||
| 17 | public function let() | |
| 18 |     { | |
| 19 | $this->beConstructedWith($this->field); | |
| 20 | } | |
| 21 | ||
| 22 | public function it_is_a_count_distinct() | |
| 23 |     { | |
| 24 | $this->shouldBeAnInstanceOf(CountDistinct::class); | |
| 25 | } | |
| 26 | ||
| 27 | public function it_is_a_operand() | |
| 28 |     { | |
| 29 | $this->shouldBeAnInstanceOf(Operand::class); | |
| 30 | } | |
| 31 | ||
| 32 | public function it_is_transformable(QueryBuilder $qb) | |
| 33 |     { | |
| 34 |         $this->transform($qb, 'a')->shouldReturn('COUNT(DISTINCT a.foo)'); | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| @@ 13-36 (lines=24) @@ | ||
| 10 | /** | |
| 11 | * @mixin SelectEntity | |
| 12 | */ | |
| 13 | class SelectEntitySpec extends ObjectBehavior | |
| 14 | { | |
| 15 | private $dqlAlias = 'u'; | |
| 16 | ||
| 17 | public function let() | |
| 18 |     { | |
| 19 | $this->beConstructedWith($this->dqlAlias); | |
| 20 | } | |
| 21 | ||
| 22 | public function it_is_a_select_entity() | |
| 23 |     { | |
| 24 | $this->shouldBeAnInstanceOf(SelectEntity::class); | |
| 25 | } | |
| 26 | ||
| 27 | public function it_is_a_selection() | |
| 28 |     { | |
| 29 | $this->shouldBeAnInstanceOf(Selection::class); | |
| 30 | } | |
| 31 | ||
| 32 | public function it_is_transformable(QueryBuilder $qb) | |
| 33 |     { | |
| 34 | $this->transform($qb, 'a')->shouldReturn($this->dqlAlias); | |
| 35 | } | |
| 36 | } | |
| 37 | ||