JmsSerializerObjectFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A test() 0 21 1
1
<?php
2
namespace Mathielen\DataImport\Writer\ObjectWriter;
3
4
class JmsSerializerObjectFactoryTest extends \PHPUnit_Framework_TestCase
5
{
6
7
    public function test()
8
    {
9
        $serializerMock = $this->createMock('JMS\Serializer\SerializerInterface');
10
11
        $className = 'TestEntities\Dummy';
12
        $of = new JmsSerializerObjectFactory($className, $serializerMock);
13
14
        $expectedObject = new \TestEntities\Dummy('Peter');
15
        $expectedJson = '{"name":"Peter"}';
16
17
        $serializerMock
18
            ->expects($this->once())
19
            ->method('deserialize')
20
            ->with($expectedJson, $className, 'json')
21
            ->will($this->returnValue($expectedObject));
22
23
        $item = array('NAME' => 'Peter');
24
        $actualObject = $of->factor($item);
25
26
        $this->assertEquals($expectedObject, $actualObject);
27
    }
28
29
}
30