/** * @test */ public function itUsesJMSSerializerToDeserializeData() { $string = '{"some_key": "Some value"}'; $object = new \stdClass(); $this->jmsSerializer->shouldReceive('deserialize')->once()->with($string, 'stdClass', 'json')->andReturn($object); $deserializedObject = $this->serializer->deserialize($string, 'stdClass'); $this->assertSame($object, $deserializedObject); }
/** * @test */ public function itSerializesAndDeserializes() { $originalObject = new Object(true, 1, 2.3, 'foo', ['bar', 'baz'], new \stdClass()); $serializedObject = $this->serializer->serialize($originalObject); $this->assertInternalType('string', $serializedObject); $deserializedObject = $this->serializer->deserialize($serializedObject, 'SimpleES\\JMSSerializerBridge\\Test\\Auxiliary\\Object'); $this->assertEquals($originalObject, $deserializedObject); }