| @@ 15-73 (lines=59) @@ | ||
| 12 | /** |
|
| 13 | * @mixin Value |
|
| 14 | */ |
|
| 15 | class ValueSpec extends ObjectBehavior |
|
| 16 | { |
|
| 17 | private $value = 'foo'; |
|
| 18 | ||
| 19 | private $valueType = null; |
|
| 20 | ||
| 21 | public function let() |
|
| 22 | { |
|
| 23 | $this->beConstructedWith($this->value, $this->valueType); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_is_a_value() |
|
| 27 | { |
|
| 28 | $this->shouldBeAnInstanceOf(Value::class); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_is_a_operand() |
|
| 32 | { |
|
| 33 | $this->shouldBeAnInstanceOf(Operand::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 37 | { |
|
| 38 | $dqlAlias = 'a'; |
|
| 39 | ||
| 40 | $qb->getParameters()->willReturn($parameters); |
|
| 41 | $parameters->count()->willReturn(10); |
|
| 42 | ||
| 43 | $qb->setParameter('comparison_10', $this->value, $this->valueType)->shouldBeCalled(); |
|
| 44 | ||
| 45 | $this->transform($qb, $dqlAlias)->shouldReturn(':comparison_10'); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function it_is_transformable_dbal_type(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 49 | { |
|
| 50 | $valueType = Type::DATE; |
|
| 51 | $this->beConstructedWith($this->value, $valueType); |
|
| 52 | ||
| 53 | $qb->getParameters()->willReturn($parameters); |
|
| 54 | $parameters->count()->willReturn(10); |
|
| 55 | ||
| 56 | $qb->setParameter('comparison_10', $this->value, $valueType)->shouldBeCalled(); |
|
| 57 | ||
| 58 | $this->transform($qb, 'a')->shouldReturn(':comparison_10'); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function it_is_transformable_pdo_type(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 62 | { |
|
| 63 | $valueType = \PDO::PARAM_INT; |
|
| 64 | $this->beConstructedWith($this->value, $valueType); |
|
| 65 | ||
| 66 | $qb->getParameters()->willReturn($parameters); |
|
| 67 | $parameters->count()->willReturn(10); |
|
| 68 | ||
| 69 | $qb->setParameter('comparison_10', $this->value, $valueType)->shouldBeCalled(); |
|
| 70 | ||
| 71 | $this->transform($qb, 'a')->shouldReturn(':comparison_10'); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| @@ 15-73 (lines=59) @@ | ||
| 12 | /** |
|
| 13 | * @mixin Values |
|
| 14 | */ |
|
| 15 | class ValuesSpec extends ObjectBehavior |
|
| 16 | { |
|
| 17 | private $values = ['foo', 'bar']; |
|
| 18 | ||
| 19 | private $valueType = null; |
|
| 20 | ||
| 21 | public function let() |
|
| 22 | { |
|
| 23 | $this->beConstructedWith($this->values, $this->valueType); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_is_a_values() |
|
| 27 | { |
|
| 28 | $this->shouldBeAnInstanceOf(Values::class); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_is_a_operand() |
|
| 32 | { |
|
| 33 | $this->shouldBeAnInstanceOf(Operand::class); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function it_is_transformable(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 37 | { |
|
| 38 | $dqlAlias = 'a'; |
|
| 39 | ||
| 40 | $qb->getParameters()->willReturn($parameters); |
|
| 41 | $parameters->count()->willReturn(10); |
|
| 42 | ||
| 43 | $qb->setParameter('comparison_10', $this->values, $this->valueType)->shouldBeCalled(); |
|
| 44 | ||
| 45 | $this->transform($qb, $dqlAlias)->shouldReturn(':comparison_10'); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function it_is_transformable_dbal_type(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 49 | { |
|
| 50 | $valueType = Type::DATE; |
|
| 51 | $this->beConstructedWith($this->values, $valueType); |
|
| 52 | ||
| 53 | $qb->getParameters()->willReturn($parameters); |
|
| 54 | $parameters->count()->willReturn(10); |
|
| 55 | ||
| 56 | $qb->setParameter('comparison_10', $this->values, $valueType)->shouldBeCalled(); |
|
| 57 | ||
| 58 | $this->transform($qb, 'a')->shouldReturn(':comparison_10'); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function it_is_transformable_pdo_type(QueryBuilder $qb, ArrayCollection $parameters) |
|
| 62 | { |
|
| 63 | $valueType = \PDO::PARAM_INT; |
|
| 64 | $this->beConstructedWith($this->values, $valueType); |
|
| 65 | ||
| 66 | $qb->getParameters()->willReturn($parameters); |
|
| 67 | $parameters->count()->willReturn(10); |
|
| 68 | ||
| 69 | $qb->setParameter('comparison_10', $this->values, $valueType)->shouldBeCalled(); |
|
| 70 | ||
| 71 | $this->transform($qb, 'a')->shouldReturn(':comparison_10'); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||