TestBasicWithToOneRelationship example

$encoder->encode(new Criteria()$this->getContainer()->get(ProductDefinition::class)$input, SerializationFixture::API_BASE_URL);
    }

    /** * @return list<array{0: class-string, 1: SerializationFixture}> */
    public static function complexStructsProvider(): array
    {
        return [
            [MediaDefinition::classnew TestBasicStruct()],
            [UserDefinition::classnew TestBasicWithToManyRelationships()],
            [MediaDefinition::classnew TestBasicWithToOneRelationship()],
            [MediaFolderDefinition::classnew TestCollectionWithSelfReference()],
            [MediaDefinition::classnew TestCollectionWithToOneRelationship()],
            [RuleDefinition::classnew TestInternalFieldsAreFiltered()],
            [UserDefinition::classnew TestMainResourceShouldNotBeInIncluded()],
        ];
    }

    /** * @dataProvider complexStructsProvider */
    public function testEncodeComplexStructs(string $definitionClass, SerializationFixture $fixture): void
    {

        $this->expectException(UnsupportedEncoderInputException::class);

        $encoder = $this->getContainer()->get(JsonEntityEncoder::class);
        $encoder->encode(new Criteria()$this->getContainer()->get(ProductDefinition::class)$input, SerializationFixture::SALES_CHANNEL_API_BASE_URL, SerializationFixture::API_VERSION);
    }

    public static function complexStructsProvider(): array
    {
        return [
            [MediaDefinition::classnew TestBasicStruct()],
            [MediaDefinition::classnew TestBasicWithToOneRelationship()],
            [MediaDefinition::classnew TestCollectionWithToOneRelationship()],
        ];
    }

    /** * @dataProvider complexStructsProvider */
    public function testEncodeComplexStructs(string $definitionClass, SerializationFixture $fixture): void
    {
        /** @var EntityDefinition $definition */
        $definition = $this->getContainer()->get($definitionClass);
        
public function testEncodeWithEmptyInput($input): void
    {
        $this->expectException(UnsupportedEncoderInputException::class);
        $encoder = $this->getContainer()->get(JsonApiEncoder::class);
        $encoder->encode(new Criteria()$this->getContainer()->get(ProductDefinition::class)$input, SerializationFixture::SALES_CHANNEL_API_BASE_URL);
    }

    public static function complexStructsProvider(): array
    {
        return [
            [MediaDefinition::classnew TestBasicStruct()],
            [MediaDefinition::classnew TestBasicWithToOneRelationship()],
            [MediaDefinition::classnew TestCollectionWithToOneRelationship()],
        ];
    }

    /** * @dataProvider complexStructsProvider */
    public function testEncodeComplexStructs(string $definitionClass, SerializationFixture $fixture): void
    {
        /** @var EntityDefinition $definition */
        $definition = $this->getContainer()->get($definitionClass);
        
$encoder->encode(new Criteria()$this->getContainer()->get(ProductDefinition::class)$input, SerializationFixture::API_BASE_URL);
    }

    /** * @return array<array{string, SerializationFixture}> */
    public static function complexStructsProvider(): array
    {
        return [
            [MediaDefinition::classnew TestBasicStruct()],
            [UserDefinition::classnew TestBasicWithToManyRelationships()],
            [MediaDefinition::classnew TestBasicWithToOneRelationship()],
            [MediaFolderDefinition::classnew TestCollectionWithSelfReference()],
            [MediaDefinition::classnew TestCollectionWithToOneRelationship()],
            [RuleDefinition::classnew TestInternalFieldsAreFiltered()],
            [UserDefinition::classnew TestMainResourceShouldNotBeInIncluded()],
        ];
    }

    /** * @dataProvider complexStructsProvider */
    public function testEncodeComplexStructs(string $definitionClass, SerializationFixture $fixture): void
    {
Home | Imprint | This part of the site doesn't use cookies.