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

testLegacyPasswordInvalidDecoratedValidatorTakesOver() public method

    public function testLegacyPasswordInvalidDecoratedValidatorTakesOver()
    {
        $passwordHash = hash('sha512', 'passwordz');
        $this->decoratedValidator->expects($this->never())->method('rehash');
        $invalid = new ValidationResult(ValidationResult::FAILURE_PASSWORD_INVALID);
        $this->decoratedValidator->expects($this->once())->method('isValid')->with('password', $passwordHash)->will($this->returnValue($invalid));
        $result = $this->decorator->isValid('password', $passwordHash);
        $this->assertFalse($result->isValid());
        $this->assertEquals(ValidationResult::FAILURE_PASSWORD_INVALID, $result->getCode());
    }