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