You are here

public function ObjectNormalizerTest::testGroupsDenormalizeWithNameConverter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php \Symfony\Component\Serializer\Tests\Normalizer\ObjectNormalizerTest::testGroupsDenormalizeWithNameConverter()

File

vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php, line 261

Class

ObjectNormalizerTest
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Component\Serializer\Tests\Normalizer

Code

public function testGroupsDenormalizeWithNameConverter() {
  $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
  $this->normalizer = new ObjectNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter());
  $this->normalizer
    ->setSerializer($this->serializer);
  $obj = new GroupDummy();
  $obj
    ->setFooBar('@dunglas');
  $obj
    ->setSymfony('@coopTilleuls');
  $this
    ->assertEquals($obj, $this->normalizer
    ->denormalize(array(
    'bar' => null,
    'foo_bar' => '@dunglas',
    'symfony' => '@coopTilleuls',
    'coop_tilleuls' => 'les-tilleuls.coop',
  ), 'Symfony\\Component\\Serializer\\Tests\\Fixtures\\GroupDummy', null, array(
    'groups' => array(
      'name_converter',
    ),
  )));
}