JeremyKendall\Password\Tests\Decorator\UpgradeDecoratorTest::testPasswordHashPasswordValidDecoratedValidatorTakesOver PHP Method

testPasswordHashPasswordValidDecoratedValidatorTakesOver() public method

    public function testPasswordHashPasswordValidDecoratedValidatorTakesOver()
    {
        $passwordHash = password_hash('password', PASSWORD_DEFAULT);
        $this->decoratedValidator->expects($this->never())->method('rehash');
        $valid = new ValidationResult(ValidationResult::SUCCESS);
        $this->decoratedValidator->expects($this->once())->method('isValid')->with('password', $passwordHash)->will($this->returnValue($valid));
        $result = $this->decorator->isValid('password', $passwordHash);
        $this->assertTrue($result->isValid());
        $this->assertEquals(ValidationResult::SUCCESS, $result->getCode());
        $this->assertNull($result->getPassword());
    }