Skip to content

Commit 23f5d8d

Browse files
committed
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
2 parents c4f7218 + 3ad7cf4 commit 23f5d8d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Tests/Constraints/RegexValidatorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public function getValidValues()
6262
array('0'),
6363
array('090909'),
6464
array(90909),
65+
array(new class() {
66+
public function __toString()
67+
{
68+
return '090909';
69+
}
70+
}),
6571
);
6672
}
6773

@@ -88,6 +94,12 @@ public function getInvalidValues()
8894
return array(
8995
array('abcd'),
9096
array('090foo'),
97+
array(new class() {
98+
public function __toString()
99+
{
100+
return 'abcd';
101+
}
102+
}),
91103
);
92104
}
93105
}

0 commit comments

Comments
 (0)