[Security] Add failing testcases for EncoderFactory
This commit is contained in:
parent
0b8b76bfef
commit
024cb91c5b
@ -55,6 +55,29 @@ class EncoderFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$expectedEncoder = new MessageDigestPasswordEncoder('sha1');
|
||||
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
|
||||
|
||||
$encoder = $factory->getEncoder('Symfony\Component\Security\Core\User\User');
|
||||
$expectedEncoder = new MessageDigestPasswordEncoder('sha1');
|
||||
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
|
||||
}
|
||||
|
||||
public function testGetEncoderConfiguredForConcreteClassWithService()
|
||||
{
|
||||
$factory = new EncoderFactory(array(
|
||||
'Symfony\Component\Security\Core\User\User' => new MessageDigestPasswordEncoder('sha1'),
|
||||
));
|
||||
|
||||
$encoder = $factory->getEncoder(new User('user', 'pass'));
|
||||
$expectedEncoder = new MessageDigestPasswordEncoder('sha1');
|
||||
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
|
||||
}
|
||||
|
||||
public function testGetEncoderConfiguredForConcreteClassWithClassName()
|
||||
{
|
||||
$factory = new EncoderFactory(array(
|
||||
'Symfony\Component\Security\Core\User\User' => new MessageDigestPasswordEncoder('sha1'),
|
||||
));
|
||||
|
||||
|
||||
$encoder = $factory->getEncoder('Symfony\Component\Security\Core\User\User');
|
||||
$expectedEncoder = new MessageDigestPasswordEncoder('sha1');
|
||||
$this->assertEquals($expectedEncoder->encodePassword('foo', ''), $encoder->encodePassword('foo', ''));
|
||||
|
Reference in New Issue
Block a user