Skip to content

Commit

Permalink
minor #29509 [Validator] Add tests in regex validator for objects wit…
Browse files Browse the repository at this point in the history
…h __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
-------

11e0df4 [Validator] Add tests in regex validator for objects with __toString method
  • Loading branch information
fabpot committed Jan 5, 2019
2 parents 2fcb367 + 11e0df4 commit 5053bfe
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -62,6 +62,12 @@ public function getValidValues()
array('0'),
array('090909'),
array(90909),
array(new class() {
public function __toString()
{
return '090909';
}
}),
);
}

Expand All @@ -88,6 +94,12 @@ public function getInvalidValues()
return array(
array('abcd'),
array('090foo'),
array(new class() {
public function __toString()
{
return 'abcd';
}
}),
);
}
}

0 comments on commit 5053bfe

Please sign in to comment.