public function testSerialize() { $obj = new ScalarDummy(); $obj->foo = 'foo'; $obj->xmlFoo = 'xml'; $this->assertEquals('foo', $this->normalizer->normalize($obj, 'json')); $this->assertEquals('xml', $this->normalizer->normalize($obj, 'xml')); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $object->setReferences($this->references); $data = parent::normalize($object, $format, $context); $this->references = array_merge($this->references, $object->getReferences()); return $data; }