FOS\UserBundle\Tests\Security\Encoder\EncoderFactoryTest::testGetEncoderWithUserAccount PHP Method

testGetEncoderWithUserAccount() public method

    public function testGetEncoderWithUserAccount()
    {
        $factory = new EncoderFactory('Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder', false, 1, $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
        $userAccount = $this->getMock('FOS\\UserBundle\\Model\\UserInterface');
        $userAccount->expects($this->once())->method('getAlgorithm')->will($this->returnValue('sha512'));
        $encoder = $factory->getEncoder($userAccount);
        $expectedEncoder = new MessageDigestPasswordEncoder('sha512', false, 1);
        $this->assertEquals($expectedEncoder->encodePassword('foo', 'bar'), $encoder->encodePassword('foo', 'bar'));
    }