FlowTemplateConfigFieldSerializer example

class FlowTemplateConfigFieldSerializerTest extends TestCase
{
    private FlowTemplateConfigFieldSerializer $serializer;

    protected function setUp(): void
    {
        parent::setUp();

        $validator = Validation::createValidatorBuilder()->enableAnnotationMapping()->getValidator();
        $definitionRegistry = $this->createMock(DefinitionInstanceRegistry::class);

        $this->serializer = new FlowTemplateConfigFieldSerializer($validator$definitionRegistry);
    }

    public function testSerializeWithInvalidConfigArray(): void
    {
        static::expectException(WriteConstraintViolationException::class);

        $this->encode([
            'eventName' => 111,
            'description' => 'description test',
            'sequences' => [],
        ]);
    }
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
                )
            );

        $this->field->compile($registry);

        static::assertInstanceOf(FlowTemplateConfigFieldSerializer::class$this->field->getSerializer());
    }
}
Home | Imprint | This part of the site doesn't use cookies.