Completed
Push — master ( 501849...1b12b8 )
by Peter
09:10 queued 13s
created

FieldSpec::it_is_change_dql_alias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace tests\Happyr\DoctrineSpecification\Operand;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Happyr\DoctrineSpecification\Operand\Field;
7
use Happyr\DoctrineSpecification\Operand\Operand;
8
use PhpSpec\ObjectBehavior;
9
10
/**
11
 * @mixin Field
12
 */
13
class FieldSpec extends ObjectBehavior
14
{
15
    private $fieldName = 'foo';
16
17
    public function let()
18
    {
19
        $this->beConstructedWith($this->fieldName);
20
    }
21
22
    public function it_is_a_field()
23
    {
24
        $this->shouldBeAnInstanceOf(Field::class);
25
    }
26
27
    public function it_is_a_operand()
28
    {
29
        $this->shouldBeAnInstanceOf(Operand::class);
30
    }
31
32
    public function it_is_transformable(QueryBuilder $qb)
33
    {
34
        $dqlAlias = 'a';
35
        $expression = 'a.foo';
36
37
        $this->transform($qb, $dqlAlias)->shouldReturn($expression);
38
    }
39
40
    public function it_is_change_dql_alias(QueryBuilder $qb)
41
    {
42
        $dqlAlias = 'a';
43
        $expression = 'b.foo';
44
45
        $this->beConstructedWith($this->fieldName, 'b');
46
        $this->transform($qb, $dqlAlias)->shouldReturn($expression);
47
    }
48
}
49