8000 [Form] Fix constraints could be null if not set by DZunke · Pull Request #16897 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] 8000 Fix constraints could be null if not set #16897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function validate($form, Constraint $constraint)

// Validate the data against the constraints defined
// in the form
$constraints = $config->getOption('constraints');
$constraints = $config->getOption('constraints', array());
foreach ($constraints as $constraint) {
foreach ($groups as $group) {
if (in_array($group, $constraint->groups)) {
Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ public function testDontValidateIfParentWithoutCascadeValidation()
$this->assertNoViolation();
}

public function testNotExistingConstraintIndex()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it testMissingConstraintIndex()?

{
$object = new \stdClass();
$form = new FormBuilder('name', '\stdClass', $this->dispatcher, $this->factory);
$form = $form->setData($object)->getForm();

$this->validator->validate($form, new Form());

$this->assertNoViolation();
}

public function testValidateConstraintsEvenIfNoCascadeValidation()
{
$object = $this->getMock('\stdClass');
Expand Down
0