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