$metadata->
getDenormalizationContexts());
} public function testGetContextsForGroups() { $metadata =
new AttributeMetadata('a1'
);
$metadata->
setNormalizationContextForGroups(['foo' => 'default', 'bar' => 'default'
],
[]);
$metadata->
setNormalizationContextForGroups(['foo' => 'overridden'
],
['a', 'b'
]);
$metadata->
setNormalizationContextForGroups(['bar' => 'overridden'
],
['c'
]);
self::
assertSame(['foo' => 'default', 'bar' => 'default'
],
$metadata->
getNormalizationContextForGroups([]));
self::
assertSame(['foo' => 'overridden', 'bar' => 'default'
],
$metadata->
getNormalizationContextForGroups(['a'
]));
self::
assertSame(['foo' => 'overridden', 'bar' => 'default'
],
$metadata->
getNormalizationContextForGroups(['b'
]));
self::
assertSame(['foo' => 'default', 'bar' => 'overridden'
],
$metadata->
getNormalizationContextForGroups(['c'
]));
self::
assertSame(['foo' => 'overridden', 'bar' => 'overridden'
],
$metadata->
getNormalizationContextForGroups(['b', 'c'
]));
$metadata->
setDenormalizationContextForGroups(['foo' => 'default', 'bar' => 'default'
],
[]);
$metadata->
setDenormalizationContextForGroups(['foo' => 'overridden'
],
['a', 'b'
]);
$metadata->
setDenormalizationContextForGroups(['bar' => 'overridden'
],
['c'
]);
self::
assertSame(['foo' => 'default', 'bar' => 'default'
],
$metadata->
getDenormalizationContextForGroups([]));
self::
assertSame(['foo' => 'overridden', 'bar' => 'default'
],
$metadata->
getDenormalizationContextForGroups(['a'
]));