$serializer =
new Serializer([new StructNormalizer()],
[new JsonEncoder()]);
$encoded =
(new StructEncoder($this->
getChainRegistry($registry),
$serializer))->
encode($product,
new ResponseFields(null
));
static::
assertArrayNotHasKey('cheapestPrice',
$encoded);
static::
assertArrayHasKey('name',
$encoded);
static::
assertEquals('test',
$encoded['name'
]);
} public function testNoneMappedFieldsAreNotExposed(): void
{ $product =
new ExtendedProductEntity();
$product->
internalSetEntityData('product',
new FieldVisibility([]));
$product->
setName('test'
);
$registry =
new StaticDefinitionInstanceRegistry( [SalesChannelProductDefinition::
class],
$this->
createMock(ValidatorInterface::
class),
$this->
createMock(EntityWriteGatewayInterface::
class) );
$serializer =
new Serializer([new StructNormalizer()],
[new JsonEncoder()]);