Code Duplication    Length = 37-37 lines in 7 locations

tests/Operand/AdditionSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin Addition
25
 */
26
class AdditionSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_add()
38
    {
39
        $this->shouldBeAnInstanceOf(Addition::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('(a.foo + :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('(a.foo + a.bar)');
61
    }
62
}
63

tests/Operand/BitAndSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin BitAnd
25
 */
26
class BitAndSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_bit_and()
38
    {
39
        $this->shouldBeAnInstanceOf(BitAnd::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('BIT_AND(a.foo, :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('BIT_AND(a.foo, a.bar)');
61
    }
62
}
63

tests/Operand/BitOrSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin BitOr
25
 */
26
class BitOrSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_bit_or()
38
    {
39
        $this->shouldBeAnInstanceOf(BitOr::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('BIT_OR(a.foo, :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('BIT_OR(a.foo, a.bar)');
61
    }
62
}
63

tests/Operand/DivisionSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin Division
25
 */
26
class DivisionSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_div()
38
    {
39
        $this->shouldBeAnInstanceOf(Division::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('(a.foo / :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('(a.foo / a.bar)');
61
    }
62
}
63

tests/Operand/ModuloSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin Modulo
25
 */
26
class ModuloSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_mod()
38
    {
39
        $this->shouldBeAnInstanceOf(Modulo::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('(a.foo % :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('(a.foo % a.bar)');
61
    }
62
}
63

tests/Operand/MultiplicationSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin Multiplication
25
 */
26
class MultiplicationSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_mul()
38
    {
39
        $this->shouldBeAnInstanceOf(Multiplication::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('(a.foo * :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('(a.foo * a.bar)');
61
    }
62
}
63

tests/Operand/SubtractionSpec.php 1 location

@@ 26-62 (lines=37) @@
23
/**
24
 * @mixin Subtraction
25
 */
26
class SubtractionSpec extends ObjectBehavior
27
{
28
    private $field = 'foo';
29
30
    private $value = 'bar';
31
32
    public function let()
33
    {
34
        $this->beConstructedWith($this->field, $this->value);
35
    }
36
37
    public function it_is_a_sub()
38
    {
39
        $this->shouldBeAnInstanceOf(Subtraction::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
        $qb->getParameters()->willReturn($parameters);
50
        $parameters->count()->willReturn(10);
51
52
        $qb->setParameter('comparison_10', $this->value, null)->shouldBeCalled();
53
54
        $this->transform($qb, 'a')->shouldReturn('(a.foo - :comparison_10)');
55
    }
56
57
    public function it_is_transformable_add_fields(QueryBuilder $qb)
58
    {
59
        $this->beConstructedWith(new Field('foo'), new Field('bar'));
60
        $this->transform($qb, 'a')->shouldReturn('(a.foo - a.bar)');
61
    }
62
}
63