File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
src/Symfony/Component/Validator/Tests/Constraints Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,26 @@ protected function createValidator()
31
31
32
32
public function testExpressionIsEvaluatedWithNullValue ()
33
33
{
34
- $ this ->context ->expects ($ this ->once ())
35
- ->method ('addViolation ' );
34
+ $ constraint = new Expression (array (
35
+ 'expression ' => 'false ' ,
36
+ 'message ' => 'myMessage ' ,
37
+ ));
36
38
37
- $ this ->validator ->validate (null , new Expression ('false ' ));
39
+ $ this ->validator ->validate ('' , $ constraint );
40
+
41
+ $ this ->assertViolation ('myMessage ' );
38
42
}
39
43
40
44
public function testExpressionIsEvaluatedWithEmptyStringValue ()
41
45
{
42
- $ this ->context ->expects ($ this ->once ())
43
- ->method ('addViolation ' );
46
+ $ constraint = new Expression (array (
47
+ 'expression ' => 'false ' ,
48
+ 'message ' => 'myMessage ' ,
49
+ ));
44
50
45
- $ this ->validator ->validate ('' , new Expression ('false ' ));
51
+ $ this ->validator ->validate ('' , $ constraint );
52
+
53
+ $ this ->assertViolation ('myMessage ' );
46
54
}
47
55
48
56
public function testSucceedingExpressionAtObjectLevel ()
You can’t perform that action at this time.
0 commit comments