FlowTemplateConfigField example


class FlowTemplateConfigFieldTest extends TestCase
{
    private FlowTemplateConfigField $field;

    protected function setUp(): void
    {
        $this->field = new FlowTemplateConfigField('config', 'config');
    }

    public function testGetSerializerWillReturnFieldSerializerInterfaceInstance(): void
    {
        $registry = $this->createMock(DefinitionInstanceRegistry::class);
        $registry
            ->method('getSerializer')
            ->willReturn(
                new FlowTemplateConfigFieldSerializer(
                    $this->createMock(ValidatorInterface::class),
                    $registry
                )
public function since(): ?string
    {
        return '6.4.18.0';
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new PrimaryKey()new Required()),
            (new StringField('name', 'name', 255))->addFlags(new Required()),
            new FlowTemplateConfigField('config', 'config'),
        ]);
    }
}
public function testDataValueIsNotArray(): void
    {
        $config = $this->encode();
        static::assertNull($config);
    }

    /** * @param array<string, mixed> $data */
    private function encode(?array $data = null, ?Field $field = null): ?string
    {
        $field ??= new FlowTemplateConfigField('config', 'config');
        $existence = new EntityExistence('config', ['someId' => true], true, false, false, []);
        $keyPair = new KeyValuePair('someId', $data, false);
        $bag = new WriteParameterBag(
            $this->createMock(FlowTemplateDefinition::class),
            WriteContext::createFromContext(Context::createDefaultContext()),
            '',
            new WriteCommandQueue()
        );

        $data = iterator_to_array($this->serializer->encode($field$existence$keyPair$bag));

        
Home | Imprint | This part of the site doesn't use cookies.