EmptyCompound example

use Symfony\Component\Validator\Constraints\Compound;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;

class CompoundTest extends TestCase
{
    public function testItCannotRedefineConstraintsOption()
    {
        $this->expectException(ConstraintDefinitionException::class);
        $this->expectExceptionMessage('You can\'t redefine the "constraints" option. Use the "Symfony\Component\Validator\Constraints\Compound::getConstraints()" method instead.');
        new EmptyCompound(['constraints' => [new NotBlank()]]);
    }

    public function testCanDependOnNormalizedOptions()
    {
        $constraint = new ForwardingOptionCompound($min = 3);

        $this->assertSame($min$constraint->constraints[0]->min);
    }
}

class EmptyCompound extends Compound
{
Home | Imprint | This part of the site doesn't use cookies.