/** * @dataProvider attributeProvider */ public function testFormatAttribute($attribute, $camelizedAttributes, $result) { $r = new \ReflectionObject($this->normalizer); $m = $r->getMethod('formatAttribute'); $m->setAccessible(true); $this->normalizer->setCamelizedAttributes($camelizedAttributes); $this->assertEquals($m->invoke($this->normalizer, $attribute, $camelizedAttributes), $result); }
/** * @group legacy */ public function testLegacyCamelizedAttributesDenormalize() { $obj = new PropertyCamelizedDummy('dunglas.fr'); $obj->fooBar = 'les-tilleuls.coop'; $obj->bar_foo = 'lostinthesupermarket.fr'; $this->normalizer->setCamelizedAttributes(array('kevin_dunglas')); $this->assertEquals($this->normalizer->denormalize(array('kevin_dunglas' => 'dunglas.fr', 'fooBar' => 'les-tilleuls.coop', 'bar_foo' => 'lostinthesupermarket.fr'), __NAMESPACE__ . '\\PropertyCamelizedDummy'), $obj); $this->normalizer->setCamelizedAttributes(array('foo_bar')); $this->assertEquals($this->normalizer->denormalize(array('kevinDunglas' => 'dunglas.fr', 'foo_bar' => 'les-tilleuls.coop', 'bar_foo' => 'lostinthesupermarket.fr'), __NAMESPACE__ . '\\PropertyCamelizedDummy'), $obj); }