minor #29864 [Form] SA fix (ro0NL)
This PR was squashed before being merged into the 3.4 branch (closes #29864).
Discussion
----------
[Form] SA fix
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
Commits
-------
1c85707946
[Form] SA fix
This commit is contained in:
commit
51d4ca3756
@ -18,8 +18,14 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||||||
|
|
||||||
trait ValidatorExtensionTrait
|
trait ValidatorExtensionTrait
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var ValidatorInterface|null
|
||||||
|
*/
|
||||||
protected $validator;
|
protected $validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ValidatorExtension
|
||||||
|
*/
|
||||||
protected function getValidatorExtension()
|
protected function getValidatorExtension()
|
||||||
{
|
{
|
||||||
if (!interface_exists(ValidatorInterface::class)) {
|
if (!interface_exists(ValidatorInterface::class)) {
|
||||||
@ -31,9 +37,9 @@ trait ValidatorExtensionTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
||||||
$metadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->setMethods(array('addPropertyConstraint'))->getMock();
|
$metadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->setMethods(['addPropertyConstraint'])->getMock();
|
||||||
$this->validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata));
|
$this->validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata));
|
||||||
$this->validator->expects($this->any())->method('validate')->will($this->returnValue(array()));
|
$this->validator->expects($this->any())->method('validate')->will($this->returnValue([]));
|
||||||
|
|
||||||
return new ValidatorExtension($this->validator);
|
return new ValidatorExtension($this->validator);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user