-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] 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
Changes from 1 commit
b44e67d
54f527e
bc33787
6fc2ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,19 @@ public function testDontValidateIfParentWithoutCascadeValidation() | |
$this->assertNoViolation(); | ||
} | ||
|
||
public function testNotExistingConstraintIndex() | ||
{ | ||
$object = $this->getMock('\stdClass'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you see any advantage of creating a dummy double for stdClass rather than simply creating the object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. I'd only copied cause of the lack of knowledge in writing tests. Thanks for the Hint! |
||
$options = array(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can omit creating this variable as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, Thanks. |
||
|
||
$form = new FormBuilder('name', '\stdClass', $this->dispatcher, $this->factory, $options); | ||
$form = $form->setData($object)->getForm(); | ||
|
||
$this->validator->validate($form, new Form()); | ||
|
||
$this->assertNoViolation(); | ||
} | ||
|
||
public function testValidateConstraintsEvenIfNoCascadeValidation() | ||
{ | ||
$object = $this->getMock('\stdClass'); | ||
|
There was a problem hiding this comment.
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()
?