Skip to content

Commit caecfa4

Browse files
committed
Adds test verifying the $validationCallback implementation
1 parent 09429e6 commit caecfa4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/JeremyKendall/Password/Tests/Decorator/KarptoniteRehashUpgradeDecoratorTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,27 @@ public function testRehashingPasswordHashesScenarioCredentialIsNotValid()
133133
$result->getCode()
134134
);
135135
}
136+
137+
/**
138+
* @dataProvider callbackDataProvider
139+
*/
140+
public function testVerifyValidationCallback($password, $result)
141+
{
142+
$isValid = call_user_func(
143+
$this->validationCallback,
144+
$password,
145+
$this->upgradedLegacyHash,
146+
$this->legacySalt
147+
);
148+
149+
$this->assertEquals($result, $isValid);
150+
}
151+
152+
public function callbackDataProvider()
153+
{
154+
return array(
155+
array('password', true),
156+
array('wrong-password', false),
157+
);
158+
}
136159
}

0 commit comments

Comments
 (0)