Skip to content

Commit 3ad7cf4

Browse files
committed
[Validator] Add tests in regex validator for objects with __toString method
1 parent efbf120 commit 3ad7cf4

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)