IdentityTransformerSpec   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 32
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 5 1
A it_transforms_identity_into_string() 0 5 1
A it_transforms_null_into_null() 0 4 1
A it_reverse_transforms_string_into_identity() 0 7 1
A it_reverse_transforms_empty_into_null() 0 4 1
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