assertTrue($hasher->needsRehash(md5('foo'))); $password = $hasher->hash('foo'); $this->assertFalse($hasher->needsRehash($password)); } /** * Tests that when the hash options change, the password needs * to be rehashed * * @return void */ public function testNeedsRehashWithDifferentOptions() { $defaultHasher = new DefaultPasswordHasher(['hashType' => PASSWORD_BCRYPT, 'hashOptions' => ['cost' => 10]]); $updatedHasher = new DefaultPasswordHasher(['hashType' => PASSWORD_BCRYPT, 'hashOptions' => ['cost' => 12]]); $password = $defaultHasher->hash('foo'); $this->assertTrue($updatedHasher->needsRehash($password)); } }