JeremyKendall\Password\Tests\Decorator\IntegrationTest::testLegacyPasswordIsValidUpgradedRehashedStored2 PHP Method

testLegacyPasswordIsValidUpgradedRehashedStored2() public method

    public function testLegacyPasswordIsValidUpgradedRehashedStored2()
    {
        $validator = new StorageDecorator(new UpgradeDecorator(new PasswordValidator(), $this->callback), $this->storage);
        $password = 'password';
        $hash = hash('sha512', $password);
        $identity = 'username';
        $this->storage->expects($this->once())->method('updatePassword')->with($identity, $this->stringContains('$2y$10$'));
        $result = $validator->isValid($password, $hash, null, $identity);
        $this->assertTrue($result->isValid());
        $this->assertEquals(ValidationResult::SUCCESS_PASSWORD_REHASHED, $result->getCode());
        $this->assertStringStartsWith('$2y$10$', $result->getPassword());
    }