-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from olssonm/dev
Update for #12
- Loading branch information
Showing
4 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,15 +38,17 @@ protected function getPackageAliases($app) | |
*/ | ||
public function test_zxcvbn_basics() | ||
{ | ||
$zxcvbn = Zxcvbn::passwordStrength('password'); | ||
|
||
$testVar1 = Zxcvbn::passwordStrength('test'); | ||
|
||
// Check keys | ||
$this->assertArrayHasKey('score', $testVar1); | ||
$this->assertArrayHasKey('match_sequence', $testVar1); | ||
$this->assertArrayHasKey('entropy', $testVar1); | ||
$this->assertArrayHasKey('password', $testVar1); | ||
$this->assertArrayHasKey('sequence', $testVar1); | ||
$this->assertArrayHasKey('crack_times_seconds', $testVar1); | ||
$this->assertArrayHasKey('crack_times_display', $testVar1); | ||
$this->assertArrayHasKey('calc_time', $testVar1); | ||
$this->assertArrayHasKey('crack_time', $testVar1); | ||
$this->assertArrayHasKey('guesses', $testVar1); | ||
|
||
// Check score-value | ||
$this->assertEquals(0, $testVar1['score']); | ||
|
@@ -57,7 +59,7 @@ public function test_zxcvbn_basics() | |
$testVar4 = Zxcvbn::passwordStrength('7E6k9axB*gwGHa&aZTohmD9Wr&NVs[b4'); //<-- 32 | ||
|
||
// Check score-value | ||
$this->assertEquals(1, $testVar2['score']); | ||
$this->assertEquals(2, $testVar2['score']); | ||
$this->assertEquals(4, $testVar3['score']); | ||
$this->assertEquals(4, $testVar4['score']); | ||
} | ||
|
@@ -106,6 +108,7 @@ public function test_password_dictionary_with_message() | |
$this->assertEquals('Just a message', $this->validate_with_message_dictionary('test', '[email protected]', 'test', 'Just a message')); | ||
} | ||
|
||
/** @note validation helper */ | ||
private function validate_without_message_min($password, $min) | ||
{ | ||
$data = ['password' => $password]; | ||
|
@@ -116,6 +119,7 @@ private function validate_without_message_min($password, $min) | |
return $validator->passes(); | ||
} | ||
|
||
/** @note validation helper */ | ||
private function validate_with_message_min($password, $min, $message) | ||
{ | ||
$data = ['password' => $password]; | ||
|
@@ -129,6 +133,7 @@ private function validate_with_message_min($password, $min, $message) | |
return $errors->first('password'); | ||
} | ||
|
||
/** @note validation helper */ | ||
private function validate_without_message_dictionary($password, $email, $username) | ||
{ | ||
$data = ['password' => $password]; | ||
|
@@ -139,6 +144,7 @@ private function validate_without_message_dictionary($password, $email, $usernam | |
return $validator->passes(); | ||
} | ||
|
||
/** @note validation helper */ | ||
private function validate_with_message_dictionary($password, $email, $username, $message) | ||
{ | ||
$data = ['password' => $password]; | ||
|