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

testLegacyPasswordIsValidUpgradedRehashedStored() public method

    public function testLegacyPasswordIsValidUpgradedRehashedStored()
    {
        $validator = new UpgradeDecorator(new StorageDecorator(new PasswordValidator(), $this->storage), $this->callback);
        $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->assertNotNull($result->getPassword());
        $this->assertStringStartsWith('$2y$10$', $result->getPassword());
    }