/**
* Not possible with dataprovider
* as we have to manipulate the container, but the dataprovider run before all tests
*/ publicfunctiontestEncodeStructWithExtension(): void { $this->registerDefinition(ExtendableDefinition::class, ExtendedDefinition::class); $extendableDefinition = newExtendableDefinition(); $extendableDefinition->addExtension(newAssociationExtension()); $extendableDefinition->addExtension(newScalarRuntimeExtension());
// check that empty "links" object is an object and not array: https://jsonapi.org/format/#document-links
static::assertStringNotContainsString('"links":[]', $actual);
/**
* Not possible with dataprovider
* as we have to manipulate the container, but the dataprovider run before all tests
*/ publicfunctiontestEncodeStructWithExtension(): void { $this->registerDefinition(ExtendableDefinition::class, ExtendedDefinition::class); $extendableDefinition = newExtendableDefinition(); $extendableDefinition->addExtension(newAssociationExtension()); $extendableDefinition->addExtension(newScalarRuntimeExtension());
/**
* Not possible with dataprovider
* as we have to manipulate the container, but the dataprovider run before all tests
*/ publicfunctiontestEncodeStructWithExtension(): void { $this->registerDefinition(ExtendableDefinition::class, ExtendedDefinition::class); $extendableDefinition = newExtendableDefinition(); $extendableDefinition->addExtension(newAssociationExtension()); $extendableDefinition->addExtension(newScalarRuntimeExtension());
/**
* Not possible with dataprovider
* as we have to manipulate the container, but the dataprovider run before all tests
*/ publicfunctiontestEncodeStructWithExtension(): void { $this->registerDefinition(ExtendableDefinition::class, ExtendedDefinition::class); $extendableDefinition = newExtendableDefinition(); $extendableDefinition->addExtension(newAssociationExtension()); $extendableDefinition->addExtension(newScalarRuntimeExtension());
// check that empty "links" object is an object and not array: https://jsonapi.org/format/#document-links
static::assertStringNotContainsString('"links":[]', $actual); static::assertStringContainsString('"links":{}', $actual);