PasswordFieldSerializer example


        $field = new PasswordField('password', 'password');
        static::assertEquals('password', $field->getStorageName());
    }

    public function testNullableField(): void
    {
        $field = new PasswordField('password', 'password');
        $existence = new EntityExistence($this->getContainer()->get(UserDefinition::class)->getEntityName()[], false, false, false, []);
        $kvPair = new KeyValuePair('password', null, true);

        $passwordFieldHandler = new PasswordFieldSerializer(
            $this->getContainer()->get(ValidatorInterface::class),
            $this->getContainer()->get(DefinitionInstanceRegistry::class),
            $this->getContainer()->get(SystemConfigService::class)
        );

        $payload = $passwordFieldHandler->encode($field$existence$kvPairnew WriteParameterBag(
            $this->getContainer()->get(UserDefinition::class),
            WriteContext::createFromContext(Context::createDefaultContext()),
            '',
            new WriteCommandQueue()
        ));

        
/** * @var ValidatorInterface&MockObject */
    protected ValidatorInterface $validator;

    protected function setUp(): void
    {
        $definitionRegistry = $this->createMock(DefinitionInstanceRegistry::class);
        $this->validator = $this->createMock(ValidatorInterface::class);
        $this->systemConfigService = $this->createMock(SystemConfigService::class);
        $this->serializer = new PasswordFieldSerializer($this->validator, $definitionRegistry$this->systemConfigService);
    }

    public function testEncodeNotPasswordField(): void
    {
        if (Feature::isActive('v6.6.0.0')) {
            static::expectException(DataAbstractionLayerException::class);
        } else {
            static::expectException(InvalidSerializerFieldException::class);
        }

        $existence = new EntityExistence('product', [], false, false, false, []);
        
Home | Imprint | This part of the site doesn't use cookies.