/**
* Not possible with dataprovider
* as we have to manipulate the container, but the dataprovider run before all tests
*/
public function testEncodeStructWithExtension(): void
{ $this->
registerDefinition(ExtendableDefinition::
class, ExtendedDefinition::
class);
$extendableDefinition =
new ExtendableDefinition();
$extendableDefinition->
addExtension(new AssociationExtension());
$extendableDefinition->
addExtension(new ScalarRuntimeExtension());
$extendableDefinition->
compile($this->
getContainer()->
get(DefinitionInstanceRegistry::
class));
$fixture =
new TestBasicWithExtension();
$encoder =
$this->
getContainer()->
get(JsonApiEncoder::
class);
$actual =
$encoder->
encode(new Criteria(),
$extendableDefinition,
$fixture->
getInput(), SerializationFixture::SALES_CHANNEL_API_BASE_URL
);
// check that empty "links" object is an object and not array: https://jsonapi.org/format/#document-links
static::
assertStringNotContainsString('"links":[]',
$actual);
// TODO: WTF? Why does it now have a self link