Skip to content

Commit cbade6b

Browse files
committed
Update test for changes in validation component
1 parent cae9836 commit cbade6b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,26 @@ protected function createValidator()
3131

3232
public function testExpressionIsEvaluatedWithNullValue()
3333
{
34-
$this->context->expects($this->once())
35-
->method('addViolation');
34+
$constraint = new Expression(array(
35+
'expression' => 'false',
36+
'message' => 'myMessage',
37+
));
3638

37-
$this->validator->validate(null, new Expression('false'));
39+
$this->validator->validate('', $constraint);
40+
41+
$this->assertViolation('myMessage');
3842
}
3943

4044
public function testExpressionIsEvaluatedWithEmptyStringValue()
4145
{
42-
$this->context->expects($this->once())
43-
->method('addViolation');
46+
$constraint = new Expression(array(
47+
'expression' => 'false',
48+
'message' => 'myMessage',
49+
));
4450

45-
$this->validator->validate('', new Expression('false'));
51+
$this->validator->validate('', $constraint);
52+
53+
$this->assertViolation('myMessage');
4654
}
4755

4856
public function testSucceedingExpressionAtObjectLevel()

0 commit comments

Comments
 (0)