You are here

public function GetSetMethodNormalizerTest::testGroupsNormalizeWithNameConverter in Zircon Profile 8

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

File

vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php, line 320

Class

GetSetMethodNormalizerTest

Namespace

Symfony\Component\Serializer\Tests\Normalizer

Code

public function testGroupsNormalizeWithNameConverter() {
  $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
  $this->normalizer = new GetSetMethodNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter());
  $this->normalizer
    ->setSerializer($this->serializer);
  $obj = new GroupDummy();
  $obj
    ->setFooBar('@dunglas');
  $obj
    ->setSymfony('@coopTilleuls');
  $obj
    ->setCoopTilleuls('les-tilleuls.coop');
  $this
    ->assertEquals(array(
    'bar' => null,
    'foo_bar' => '@dunglas',
    'symfony' => '@coopTilleuls',
  ), $this->normalizer
    ->normalize($obj, null, array(
    'groups' => array(
      'name_converter',
    ),
  )));
}