Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Expression;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Traverse;
use Symfony\Component\Validator\Constraints\Valid;
@@ -670,4 +671,38 @@ abstract class AbstractTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame($constraint, $violations[0]->getConstraint());
}
public function testNestedObjectIsNotValidatedIfGroupInValidConstraintIsNotValidated()
{
$entity = new Entity();
$entity->firstName = '';
$reference = new Reference();
$reference->value = '';
$entity->childA = $reference;
$this->metadata->addPropertyConstraint('firstName', new NotBlank(array('groups' => 'group1')));
$this->metadata->addPropertyConstraint('childA', new Valid(array('groups' => 'group1')));
$this->referenceMetadata->addPropertyConstraint('value', new NotBlank());
$violations = $this->validator->validate($entity, null, array());
$this->assertCount(0, $violations);
}
public function testNestedObjectIsValidatedIfGroupInValidConstraintIsValidated()
{
$entity = new Entity();
$entity->firstName = '';
$reference = new Reference();
$reference->value = '';
$entity->childA = $reference;
$this->metadata->addPropertyConstraint('firstName', new NotBlank(array('groups' => 'group1')));
$this->metadata->addPropertyConstraint('childA', new Valid(array('groups' => 'group1')));
$this->referenceMetadata->addPropertyConstraint('value', new NotBlank(array('groups' => 'group1')));
$violations = $this->validator->validate($entity, null, array('Default', 'group1'));
$this->assertCount(2, $violations);
}
}
@@ -1172,7 +1172,7 @@ abstract class AbstractValidatorTest extends TestCase
$context->addViolation('Violation in Group 3');
};
$metadata = new ClassMetadata(get_class($entity));
$metadata = new ClassMetadata(\get_class($entity));
$metadata->addConstraint(new Callback(array(
'callback' => function () {},
'groups' => 'Group 1',
@@ -1192,7 +1192,7 @@ abstract class AbstractValidatorTest extends TestCase
$violations = $this->validate($entity, null, 'Default');
/* @var ConstraintViolationInterface[] $violations */
$this->assertCount(count($assertViolations), $violations);
$this->assertCount(\count($assertViolations), $violations);
foreach ($assertViolations as $key => $message) {
$this->assertSame($message, $violations[$key]->getMessage());
}