11
11
12
12
namespace Symfony \Component \Validator \Tests \Constraints ;
13
13
14
- use Symfony \Component \Validator \Constraints \NotSuspicious ;
15
- use Symfony \Component \Validator \Constraints \NotSuspiciousValidator ;
14
+ use Symfony \Component \Validator \Constraints \NoSuspiciousCharacters ;
15
+ use Symfony \Component \Validator \Constraints \NoSuspiciousCharactersValidator ;
16
16
use Symfony \Component \Validator \Test \ConstraintValidatorTestCase ;
17
17
18
18
/**
19
19
* @requires extension intl
20
20
*
21
- * @extends ConstraintValidatorTestCase<NotSuspiciousValidator >
21
+ * @extends ConstraintValidatorTestCase<NoSuspiciousCharactersValidator >
22
22
*/
23
- class NotSuspiciousValidatorTest extends ConstraintValidatorTestCase
23
+ class NoSuspiciousCharactersValidatorTest extends ConstraintValidatorTestCase
24
24
{
25
- protected function createValidator (): NotSuspiciousValidator
25
+ protected function createValidator (): NoSuspiciousCharactersValidator
26
26
{
27
- $ validator = new NotSuspiciousValidator ();
27
+ $ validator = new NoSuspiciousCharactersValidator ();
28
28
$ validator ->setLocale (\Locale::getDefault ());
29
29
30
30
return $ validator ;
31
31
}
32
32
33
33
public function testNonSuspiciousStrings ()
34
34
{
35
- $ this ->validator ->validate ('à ' , new NotSuspicious ());
35
+ $ this ->validator ->validate ('à ' , new NoSuspiciousCharacters ());
36
36
37
37
$ this ->assertNoViolation ();
38
38
}
@@ -42,7 +42,7 @@ public function testNonSuspiciousStrings()
42
42
*/
43
43
public function testSuspiciousStrings (string $ string , array $ options )
44
44
{
45
- $ this ->validator ->validate ($ string , new NotSuspicious (['message ' => 'myMessage ' ] + $ options ));
45
+ $ this ->validator ->validate ($ string , new NoSuspiciousCharacters (['message ' => 'myMessage ' ] + $ options ));
46
46
47
47
$ this ->buildViolation ('myMessage ' )
48
48
->setParameter ('{{ value }} ' , '" ' .$ string .'" ' )
@@ -67,21 +67,21 @@ public static function provideSuspiciousStrings(): iterable
67
67
'profileLocales ' => ['el_GR ' ],
68
68
]];
69
69
yield 'Fails restriction level check because of Greek script absent from profile ' => ['àπ ' , [
70
- 'checks ' => NotSuspicious ::CHECK_RESTRICTION_LEVEL ,
70
+ 'checks ' => NoSuspiciousCharacters ::CHECK_RESTRICTION_LEVEL ,
71
71
'restrictionLevel ' => \Spoofchecker::MINIMALLY_RESTRICTIVE ,
72
72
]];
73
73
74
74
yield 'Fails INVISIBLE check because of duplicated non-spacing mark ' => ['à̀ ' , [
75
- 'checks ' => NotSuspicious ::CHECK_INVISIBLE ,
75
+ 'checks ' => NoSuspiciousCharacters ::CHECK_INVISIBLE ,
76
76
]];
77
77
yield 'Fails CHAR_LIMIT check because of Greek script absent from profile ' => ['àπ ' , [
78
- 'checks ' => NotSuspicious ::CHECK_CHAR_LIMIT ,
78
+ 'checks ' => NoSuspiciousCharacters ::CHECK_CHAR_LIMIT ,
79
79
]];
80
80
yield 'Fails MIXED_NUMBERS check because of different numbering systems ' => ['8৪ ' , [
81
- 'checks ' => NotSuspicious ::CHECK_MIXED_NUMBERS ,
81
+ 'checks ' => NoSuspiciousCharacters ::CHECK_MIXED_NUMBERS ,
82
82
]];
83
83
yield 'Fails HIDDEN_OVERLAY check because of hidden combining character ' => ['i̇ ' , [
84
- 'checks ' => NotSuspicious ::CHECK_HIDDEN_OVERLAY ,
84
+ 'checks ' => NoSuspiciousCharacters ::CHECK_HIDDEN_OVERLAY ,
85
85
]];
86
86
}
87
87
}
0 commit comments