Completed
Push — 1.0 ( ea6409...9b1c59 )
by Peter
08:58
created

BitLeftShiftSpec::it_is_transformable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace tests\Happyr\DoctrineSpecification\Operand;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\QueryBuilder;
7
use Happyr\DoctrineSpecification\Operand\BitLeftShift;
8
use Happyr\DoctrineSpecification\Operand\Field;
9
use PhpSpec\ObjectBehavior;
10
11
/**
12
 * @mixin BitLeftShift
13
 */
14 View Code Duplication
class BitLeftShiftSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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_bit_left_shift()
26
    {
27
        $this->shouldBeAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitLeftShift');
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