trait ContextMetadataTestTrait
{ /**
* @dataProvider contextMetadataDummyProvider
*/
public function testContextMetadataNormalize(string
$contextMetadataDummyClass) { $classMetadataFactory =
new ClassMetadataFactory(new AnnotationLoader());
$normalizer =
new ObjectNormalizer($classMetadataFactory, null, null,
new PhpDocExtractor());
new Serializer([new DateTimeNormalizer(),
$normalizer]);
$dummy =
new $contextMetadataDummyClass();
$dummy->date =
new \
DateTimeImmutable('2011-07-28T08:44:00.123+00:00'
);
self::
assertEquals(['date' => '2011-07-28T08:44:00+00:00'
],
$normalizer->
normalize($dummy));
self::
assertEquals(['date' => '2011-07-28T08:44:00.123+00:00'
],
$normalizer->
normalize($dummy, null,
[ ObjectNormalizer::GROUPS => 'extended',
]), 'a specific normalization context is used for this group'
);
self::
assertEquals(['date' => '2011-07-28T08:44:00+00:00'
],
$normalizer->
normalize($dummy, null,
[