Skip to content
Permalink
Browse files

[Security] validate empty passwords again

  • Loading branch information...
xabbuh committed Jul 14, 2017
1 parent 62fdf9c commit 878198cefae028386c6dc800ccbf18f2b9cbff3f
@@ -90,6 +90,29 @@ public function testPasswordIsNotValid()
->assertRaised();
}
/**
* @dataProvider emptyPasswordData
*/
public function testEmptyPasswordsAreNotValid($password)
{
$constraint = new UserPassword(array(
'message' => 'myMessage',
));
$this->validator->validate($password, $constraint);
$this->buildViolation('myMessage')
->assertRaised();
}
public function emptyPasswordData()
{
return array(
array(null),
array(''),
);
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
@@ -40,6 +40,8 @@ public function validate($password, Constraint $constraint)
}
if (null === $password || '' === $password) {
$this->context->addViolation($constraint->message);
return;
}

0 comments on commit 878198c

Please sign in to comment.
You can’t perform that action at this time.