IsTrueValidator example

namespace Symfony\Component\Validator\Tests\Constraints;

use Symfony\Component\Validator\Constraints\IsTrue;
use Symfony\Component\Validator\Constraints\IsTrueValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

class IsTrueValidatorTest extends ConstraintValidatorTestCase
{
    protected function createValidator(): IsTrueValidator
    {
        return new IsTrueValidator();
    }

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

        $this->assertNoViolation();
    }

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