minor #29509 [Validator] Add tests in regex validator for objects with __toString method (raulfraile)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Validator] Add tests in regex validator for objects with __toString method

This PR adds tests to cover objects implementing the `__toString` method for the `Regex` validator.

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (careful when merging)
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Commits
-------

11e0df4f55 [Validator] Add tests in regex validator for objects with __toString method
This commit is contained in:
Fabien Potencier 2019-01-05 08:52:57 +01:00
commit 5053bfec14

View File

@ -62,6 +62,12 @@ class RegexValidatorTest extends ConstraintValidatorTestCase
array('0'),
array('090909'),
array(90909),
array(new class() {
public function __toString()
{
return '090909';
}
}),
);
}
@ -88,6 +94,12 @@ class RegexValidatorTest extends ConstraintValidatorTestCase
return array(
array('abcd'),
array('090foo'),
array(new class() {
public function __toString()
{
return 'abcd';
}
}),
);
}
}