/** * @expectedException \InvalidArgumentException */ public function testUncallableCallbacks() { $this->normalizer->setCallbacks(array('bar' => null)); $obj = new PropertyConstructorDummy('baz', 'quux'); $this->normalizer->normalize($obj, 'any'); }
public function benchSymfonyPropertyNormalizer() { $normalizer = new PropertyNormalizer(); $normalizer->setCallbacks(array('createdAt' => function (\DateTime $date) { return $date->format(\DateTime::RFC3339); })); $normalizer->setIgnoredAttributes(['user', 'password']); $normalizers = array($normalizer); $encoders = array(new JsonEncoder()); $symfony = new Serializer($normalizers, $encoders); return $symfony->serialize($this->data, 'json'); }