Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
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 | |||
30 |