minor #21886 [Form] Add validate method to mockec validator in form TypeTestCase (pierredup)
This PR was merged into the 2.7 branch.
Discussion
----------
[Form] Add validate method to mockec validator in form TypeTestCase
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
When using the `Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase` class to unit test forms, the `validate` method is not mocked, which causes errors when the unit tests run.
Commits
-------
4013e7b
Add validate method to mockec validator in form TypeTestCase
This commit is contained in:
commit
24f3135b11
@ -23,6 +23,7 @@ abstract class TypeTestCase extends BaseTypeTestCase
|
||||
$this->validator = $this->getMockBuilder('Symfony\Component\Validator\Validator\ValidatorInterface')->getMock();
|
||||
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||
$this->validator->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
|
||||
$this->validator->expects($this->any())->method('validate')->will($this->returnValue(array()));
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
Reference in New Issue
Block a user