19
19
use Symfony \Component \Validator \Constraints \NotBlank ;
20
20
use Symfony \Component \Validator \Constraints \NotNull ;
21
21
use Symfony \Component \Validator \Constraints \Range ;
22
- use Symfony \Component \Validator \Constraints \True ;
22
+ use Symfony \Component \Validator \Constraints \IsTrue ;
23
23
use Symfony \Component \Validator \Constraints \Type ;
24
24
use Symfony \Component \Validator \Mapping \ClassMetadata ;
25
25
@@ -64,7 +64,7 @@ public function guessRequiredProvider()
64
64
return array (
65
65
array (new NotNull (), new ValueGuess (true , Guess::HIGH_CONFIDENCE )),
66
66
array (new NotBlank (), new ValueGuess (true , Guess::HIGH_CONFIDENCE )),
67
- array (new True (), new ValueGuess (true , Guess::HIGH_CONFIDENCE )),
67
+ array (new IsTrue (), new ValueGuess (true , Guess::HIGH_CONFIDENCE )),
68
68
array (new Length (10 ), new ValueGuess (false , Guess::LOW_CONFIDENCE )),
69
69
array (new Range (array ('min ' => 1 , 'max ' => 20 )), new ValueGuess (false , Guess::LOW_CONFIDENCE )),
70
70
);
@@ -84,6 +84,18 @@ public function testGuessRequired($constraint, $guess)
84
84
$ this ->assertEquals ($ guess , $ this ->guesser ->guessRequired (self ::TEST_CLASS , self ::TEST_PROPERTY ));
85
85
}
86
86
87
+ /**
88
+ * @group legacy
89
+ */
90
+ public function testLegacyGuessRequired ()
91
+ {
92
+ if (PHP_VERSION_ID >= 70000 ) {
93
+ $ this ->markTestSkipped ('Cannot use a class called True on PHP 7 or higher. ' );
94
+ }
95
+ $ true = 'Symfony\Component\Validator\Constraints\True ' ;
96
+ $ this ->testGuessRequired (new $ true (), new ValueGuess (true , Guess::HIGH_CONFIDENCE ));
97
+ }
98
+
87
99
public function testGuessRequiredReturnsFalseForUnmappedProperties ()
88
100
{
89
101
$ this ->assertEquals (new ValueGuess (false , Guess::LOW_CONFIDENCE ), $ this ->guesser ->guessRequired (self ::TEST_CLASS , self ::TEST_PROPERTY ));
0 commit comments