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