PropertyGroupOptionEntity example

public static function buildingProvider(): \Generator
    {
        yield 'Test without options' => [
            new ProductEntity(),
            [],
        ];

        yield 'Test without loaded option groups' => [
            (new ProductEntity())->assign([
                '_uniqueIdentifier' => Uuid::randomHex(),
                'options' => new PropertyGroupOptionCollection([
                    (new PropertyGroupOptionEntity())->assign([
                        '_uniqueIdentifier' => Uuid::randomHex(),
                        'name' => 'red',
                    ]),
                ]),
            ]),
            [],
        ];

        yield 'Test with valid product' => [
            (new ProductEntity())->assign([
                '_uniqueIdentifier' => Uuid::randomHex(),
                
$propertyGroup->setDisplayType(PropertyGroupDefinition::DISPLAY_TYPE_TEXT);
        $propertyGroup->setPosition(1);
        $propertyGroup->setOptions($this->getPropertyOptionsMixed());

        return new PropertyGroupCollection([$propertyGroup]);
    }

    private function getPropertyOptionsOnlyNumbers(): PropertyGroupOptionCollection
    {
        $propertyOptions = [];
        for ($x = 0; $x < 50; ++$x) {
            $propertyOption = new PropertyGroupOptionEntity();
            $propertyOption->setId(Uuid::randomHex());
            $propertyOption->setPosition(1);
            $propertyOption->setName((string) $x);
            $propertyOption->setTranslated([
                'name' => (string) $x,
                'description' => '',
                'position' => 1,
                'customFields' => [],
            ]);
            $propertyOptions[] = $propertyOption;
        }
        
$this->createMock(EntityWriteGatewayInterface::class)
        );

        $repository = new StaticEntityRepository([
            function DCriteria $criteria) {
                static::assertContains('red', $criteria->getIds());
                static::assertContains('green', $criteria->getIds());
                static::assertContains('xl', $criteria->getIds());
                static::assertContains('l', $criteria->getIds());

                return new PropertyGroupOptionCollection([
                    (new PropertyGroupOptionEntity())->assign([
                        'id' => 'red',
                        'groupId' => 'color',
                        'position' => 1,
                        'group' => (new PropertyGroupEntity())->assign([
                            'id' => 'color',
                            'position' => 1,
                        ]),
                    ]),
                    (new PropertyGroupOptionEntity())->assign([
                        'id' => 'green',
                        'groupId' => 'color',
                        
Home | Imprint | This part of the site doesn't use cookies.