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'
);
} catch (DataAbstractionLayerException
$e) { static::
assertSame(DataAbstractionLayerException::INVALID_FIELD_SERIALIZER_CODE,
$e->
getErrorCode());
} }