IdentityTransformerSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace spec\HMLB\DDDBundle\Form\DataTransformer;
4
5
use HMLB\DDD\Entity\Identity;
6
use PhpSpec\ObjectBehavior;
7
8
class IdentityTransformerSpec extends ObjectBehavior
9
{
10
    public function it_is_initializable()
11
    {
12
        $this->shouldHaveType('HMLB\DDDBundle\Form\DataTransformer\IdentityTransformer');
13
        $this->shouldHaveType('Symfony\Component\Form\DataTransformerInterface');
14
    }
15
16
    public function it_transforms_identity_into_string()
17
    {
18
        $id = new Identity();
19
        $this->transform($id)->shouldBe($id->__toString());
20
    }
21
22
    public function it_transforms_null_into_null()
23
    {
24
        $this->transform(null)->shouldBe(null);
25
    }
26
27
    public function it_reverse_transforms_string_into_identity()
28
    {
29
        $string = 'Ae7r5fS£é"zzaéàçze!rsuiodESR';
30
        $result = $this->reverseTransform($string);
31
        $result->shouldHaveType('HMLB\DDD\Entity\Identity');
32
        $result->__toString()->shouldBe($string);
33
    }
34
35
    public function it_reverse_transforms_empty_into_null()
36
    {
37
        $this->reverseTransform(null)->shouldBe(null);
38
    }
39
}
40