| @@ 14-57 (lines=44) @@ | ||
| 11 | /** |
|
| 12 | * @mixin AddSelect |
|
| 13 | */ |
|
| 14 | class AddSelectSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | public function let() |
|
| 17 | { |
|
| 18 | $this->beConstructedWith('foo'); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function it_is_a_add_select() |
|
| 22 | { |
|
| 23 | $this->shouldBeAnInstanceOf(AddSelect::class); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_is_a_specification() |
|
| 27 | { |
|
| 28 | $this->shouldHaveType(QueryModifier::class); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_add_select_single_filed(QueryBuilder $qb) |
|
| 32 | { |
|
| 33 | $qb->addSelect(['a.foo'])->shouldBeCalled(); |
|
| 34 | $this->modify($qb, 'a'); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function it_add_select_several_fields(QueryBuilder $qb) |
|
| 38 | { |
|
| 39 | $this->beConstructedWith('foo', 'bar'); |
|
| 40 | $qb->addSelect(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 41 | $this->modify($qb, 'b'); |
|
| 42 | } |
|
| 43 | ||
| 44 | public function it_add_select_several_fields_as_array(QueryBuilder $qb) |
|
| 45 | { |
|
| 46 | $this->beConstructedWith(['foo', 'bar']); |
|
| 47 | $qb->addSelect(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 48 | $this->modify($qb, 'b'); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function it_add_select_operand(QueryBuilder $qb) |
|
| 52 | { |
|
| 53 | $this->beConstructedWith('foo', new Field('bar')); |
|
| 54 | $qb->addSelect(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 55 | $this->modify($qb, 'b'); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 14-57 (lines=44) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Select |
|
| 13 | */ |
|
| 14 | class SelectSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | public function let() |
|
| 17 | { |
|
| 18 | $this->beConstructedWith('foo'); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function it_is_a_select() |
|
| 22 | { |
|
| 23 | $this->shouldBeAnInstanceOf(Select::class); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_is_a_specification() |
|
| 27 | { |
|
| 28 | $this->shouldHaveType(QueryModifier::class); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_select_single_filed(QueryBuilder $qb) |
|
| 32 | { |
|
| 33 | $qb->select(['a.foo'])->shouldBeCalled(); |
|
| 34 | $this->modify($qb, 'a'); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function it_select_several_fields(QueryBuilder $qb) |
|
| 38 | { |
|
| 39 | $this->beConstructedWith('foo', 'bar'); |
|
| 40 | $qb->select(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 41 | $this->modify($qb, 'b'); |
|
| 42 | } |
|
| 43 | ||
| 44 | public function it_select_several_fields_as_array(QueryBuilder $qb) |
|
| 45 | { |
|
| 46 | $this->beConstructedWith(['foo', 'bar']); |
|
| 47 | $qb->select(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 48 | $this->modify($qb, 'b'); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function it_select_operand(QueryBuilder $qb) |
|
| 52 | { |
|
| 53 | $this->beConstructedWith('foo', new Field('bar')); |
|
| 54 | $qb->select(['b.foo', 'b.bar'])->shouldBeCalled(); |
|
| 55 | $this->modify($qb, 'b'); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||