| @@ 14-50 (lines=37) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Addition |
|
| 13 | */ |
|
| 14 | class AdditionSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | private $field = 'foo'; |
|
| 17 | ||
| 18 | private $value = 'bar'; |
|
| 19 | ||
| 20 | public function let() |
|
| 21 | { |
|
| 22 | $this->beConstructedWith($this->field, $this->value); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_a_add() |
|
| 26 | { |
|
| 27 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Addition'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function it_is_a_operand() |
|
| 31 | { |
|
| 32 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Operand'); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 36 | { |
|
| 37 | $qb->getParameters()->willReturn($parameters); |
|
| 38 | $parameters->count()->willReturn(10); |
|
| 39 | ||
| 40 | $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled(); |
|
| 41 | ||
| 42 | $this->transform($qb, 'a')->shouldReturn('(a.foo + :comparison_10)'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function it_is_transformable_add_fields(QueryBuilder $qb) |
|
| 46 | { |
|
| 47 | $this->beConstructedWith(new Field('foo'), new Field('bar')); |
|
| 48 | $this->transform($qb, 'a')->shouldReturn('(a.foo + a.bar)'); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 14-50 (lines=37) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Division |
|
| 13 | */ |
|
| 14 | class DivisionSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | private $field = 'foo'; |
|
| 17 | ||
| 18 | private $value = 'bar'; |
|
| 19 | ||
| 20 | public function let() |
|
| 21 | { |
|
| 22 | $this->beConstructedWith($this->field, $this->value); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_a_div() |
|
| 26 | { |
|
| 27 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Division'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function it_is_a_operand() |
|
| 31 | { |
|
| 32 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Operand'); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 36 | { |
|
| 37 | $qb->getParameters()->willReturn($parameters); |
|
| 38 | $parameters->count()->willReturn(10); |
|
| 39 | ||
| 40 | $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled(); |
|
| 41 | ||
| 42 | $this->transform($qb, 'a')->shouldReturn('(a.foo / :comparison_10)'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function it_is_transformable_add_fields(QueryBuilder $qb) |
|
| 46 | { |
|
| 47 | $this->beConstructedWith(new Field('foo'), new Field('bar')); |
|
| 48 | $this->transform($qb, 'a')->shouldReturn('(a.foo / a.bar)'); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 14-50 (lines=37) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Modulo |
|
| 13 | */ |
|
| 14 | class ModuloSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | private $field = 'foo'; |
|
| 17 | ||
| 18 | private $value = 'bar'; |
|
| 19 | ||
| 20 | public function let() |
|
| 21 | { |
|
| 22 | $this->beConstructedWith($this->field, $this->value); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_a_mod() |
|
| 26 | { |
|
| 27 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Modulo'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function it_is_a_operand() |
|
| 31 | { |
|
| 32 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Operand'); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 36 | { |
|
| 37 | $qb->getParameters()->willReturn($parameters); |
|
| 38 | $parameters->count()->willReturn(10); |
|
| 39 | ||
| 40 | $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled(); |
|
| 41 | ||
| 42 | $this->transform($qb, 'a')->shouldReturn('(a.foo % :comparison_10)'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function it_is_transformable_add_fields(QueryBuilder $qb) |
|
| 46 | { |
|
| 47 | $this->beConstructedWith(new Field('foo'), new Field('bar')); |
|
| 48 | $this->transform($qb, 'a')->shouldReturn('(a.foo % a.bar)'); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 14-50 (lines=37) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Multiplication |
|
| 13 | */ |
|
| 14 | class MultiplicationSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | private $field = 'foo'; |
|
| 17 | ||
| 18 | private $value = 'bar'; |
|
| 19 | ||
| 20 | public function let() |
|
| 21 | { |
|
| 22 | $this->beConstructedWith($this->field, $this->value); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_a_mul() |
|
| 26 | { |
|
| 27 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Multiplication'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function it_is_a_operand() |
|
| 31 | { |
|
| 32 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Operand'); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 36 | { |
|
| 37 | $qb->getParameters()->willReturn($parameters); |
|
| 38 | $parameters->count()->willReturn(10); |
|
| 39 | ||
| 40 | $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled(); |
|
| 41 | ||
| 42 | $this->transform($qb, 'a')->shouldReturn('(a.foo * :comparison_10)'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function it_is_transformable_add_fields(QueryBuilder $qb) |
|
| 46 | { |
|
| 47 | $this->beConstructedWith(new Field('foo'), new Field('bar')); |
|
| 48 | $this->transform($qb, 'a')->shouldReturn('(a.foo * a.bar)'); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 14-50 (lines=37) @@ | ||
| 11 | /** |
|
| 12 | * @mixin Subtraction |
|
| 13 | */ |
|
| 14 | class SubtractionSpec extends ObjectBehavior |
|
| 15 | { |
|
| 16 | private $field = 'foo'; |
|
| 17 | ||
| 18 | private $value = 'bar'; |
|
| 19 | ||
| 20 | public function let() |
|
| 21 | { |
|
| 22 | $this->beConstructedWith($this->field, $this->value); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function it_is_a_sub() |
|
| 26 | { |
|
| 27 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Subtraction'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function it_is_a_operand() |
|
| 31 | { |
|
| 32 | $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\Operand'); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 36 | { |
|
| 37 | $qb->getParameters()->willReturn($parameters); |
|
| 38 | $parameters->count()->willReturn(10); |
|
| 39 | ||
| 40 | $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled(); |
|
| 41 | ||
| 42 | $this->transform($qb, 'a')->shouldReturn('(a.foo - :comparison_10)'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function it_is_transformable_add_fields(QueryBuilder $qb) |
|
| 46 | { |
|
| 47 | $this->beConstructedWith(new Field('foo'), new Field('bar')); |
|
| 48 | $this->transform($qb, 'a')->shouldReturn('(a.foo - a.bar)'); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||