FOS\UserBundle\Tests\Model\UserManagerTest::testUpdatePassword PHP Method

testUpdatePassword() public method

public testUpdatePassword ( )
    public function testUpdatePassword()
    {
        $encoder = $this->getMockPasswordEncoder();
        $user = $this->getUser();
        $user->setPlainPassword('password');
        $this->encoderFactory->expects($this->once())->method('getEncoder')->will($this->returnValue($encoder));
        $encoder->expects($this->once())->method('encodePassword')->with('password', $user->getSalt())->will($this->returnValue('encodedPassword'));
        $this->manager->updatePassword($user);
        $this->assertEquals($this->algorithm, $user->getAlgorithm(), '->updatePassword() sets algorithm');
        $this->assertEquals('encodedPassword', $user->getPassword(), '->updatePassword() sets encoded password');
        $this->assertNull($user->getPlainPassword(), '->updatePassword() erases credentials');
    }