static::
assertArrayHasKey('variant_listing_config',
$result);
$result =
json_decode($result['variant_listing_config'
], true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame($data['displayParent'
],
$result['displayParent'
]);
static::
assertSame($data['mainVariantId'
],
$result['mainVariantId'
]);
static::
assertSame($data['configuratorGroupConfig'
],
$result['configuratorGroupConfig'
]);
} public function testEncodeThrowExceptionOnWrongField(): void
{ $field =
new JsonField('variant_listing_config', 'variantListingConfig'
);
$existence =
new EntityExistence('test',
['someId' => 'foo'
], true, false, false,
[]);
$keyPair =
new KeyValuePair('someId', null, false
);
$bag =
new WriteParameterBag( new ProductDefinition(),
WriteContext::
createFromContext(Context::
createDefaultContext()),
'',
new WriteCommandQueue() );
try { iterator_to_array($this->serializer->
encode($field,
$existence,
$keyPair,
$bag));
static::
fail('encode with incorrect field'
);
}