Iban example

use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

class IbanValidatorTest extends ConstraintValidatorTestCase
{
    protected function createValidator(): IbanValidator
    {
        return new IbanValidator();
    }

    public function testNullIsValid()
    {
        $this->validator->validate(null, new Iban());

        $this->assertNoViolation();
    }

    public function testEmptyStringIsValid()
    {
        $this->validator->validate('', new Iban());

        $this->assertNoViolation();
    }

    
#[Assert\Type(type: 'int')]     public $alreadyMappedType;

    #[Assert\NotNull]     public $alreadyMappedNotNull;

    #[Assert\NotBlank]     public $alreadyMappedNotBlank;

    #[Assert\All([         new Assert\Type(type: 'string'),
        new Assert\Iban(),
    ])]
    public $alreadyPartiallyMappedCollection;

    public $readOnly;

    #[Assert\DisableAutoMapping]     public $noAutoMapping;

    public function setNonExistentField()
    {
    }
}
Home | Imprint | This part of the site doesn't use cookies.