File tree 2 files changed +17
-11
lines changed
src/Symfony/Component/Validator/Tests/Constraints 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 17
17
use Symfony \Component \Validator \Mapping \ClassMetadata ;
18
18
use Symfony \Component \Validator \Mapping \Loader \AnnotationLoader ;
19
19
20
- /**
21
- * @requires PHP 8
22
- */
23
20
class UniqueTest extends TestCase
24
21
{
22
+ /**
23
+ * @requires PHP 8
24
+ */
25
25
public function testAttributes ()
26
26
{
27
27
$ metadata = new ClassMetadata (UniqueDummy::class);
@@ -35,6 +35,9 @@ public function testAttributes()
35
35
[$ cConstraint ] = $ metadata ->properties ['c ' ]->getConstraints ();
36
36
self ::assertSame (['my_group ' ], $ cConstraint ->groups );
37
37
self ::assertSame ('some attached data ' , $ cConstraint ->payload );
38
+
39
+ [$ dConstraint ] = $ metadata ->properties ['d ' ]->getConstraints ();
40
+ self ::assertSame (['intval ' ], $ dConstraint ->normalizer );
38
41
}
39
42
40
43
public function testInvalidNormalizerThrowsException ()
@@ -62,4 +65,7 @@ class UniqueDummy
62
65
63
66
#[Unique(groups: ['my_group ' ], payload: 'some attached data ' )]
64
67
private $ c ;
68
+
69
+ #[Unique(normalizer: 'intval ' )]
70
+ private $ d ;
65
71
}
Original file line number Diff line number Diff line change 16
16
use Symfony \Component \Validator \Exception \UnexpectedValueException ;
17
17
use Symfony \Component \Validator \Test \ConstraintValidatorTestCase ;
18
18
19
- class CallableClass
20
- {
21
- public static function execute (\stdClass $ object )
22
- {
23
- return [$ object ->name , $ object ->email ];
24
- }
25
- }
26
-
27
19
class UniqueValidatorTest extends ConstraintValidatorTestCase
28
20
{
29
21
protected function createValidator ()
@@ -232,3 +224,11 @@ public function testExpectsValidCaseInsensitiveComparison()
232
224
$ this ->assertNoViolation ();
233
225
}
234
226
}
227
+
228
+ class CallableClass
229
+ {
230
+ public static function execute (\stdClass $ object )
231
+ {
232
+ return [$ object ->name , $ object ->email ];
233
+ }
234
+ }
You can’t perform that action at this time.
0 commit comments