Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split all the validators #84

Merged
merged 4 commits into from
Aug 27, 2019
Merged

Split all the validators #84

merged 4 commits into from
Aug 27, 2019

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Aug 12, 2019

Cleans it up a bit.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So clean 🧐

lib/PasswordValidator.php Show resolved Hide resolved
public function validate(string $password): bool {
$enforceNonCommonPassword = $this->config->getEnforceNonCommonPassword();
if($enforceNonCommonPassword) {
$passwordFile = __DIR__ . '/../../lists/list-'.strlen($password).'.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the $passwordFile assigment one line up and combine the first two if's for better readibility

lib/Validator/IValidator.php Outdated Show resolved Hide resolved
['banana', false, true],
['bananabananabananabanana', false, true],
['banana', true, false],
['bananabananabananabanana', true, true],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

@@ -66,7 +66,8 @@ public function testValidate(string $password, bool $enforced, bool $valid) {
$this->expectException(HintException::class);
}

$this->assertTrue($this->validator->validate($password));
$this->assertTrue(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? What if if fails?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it either throws an exception or not.
The assert is there to ensure phpunit is quite about risky tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer force-pushed the enh/split_into_validators branch from 4000ea6 to 776583e Compare August 27, 2019 12:52
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer force-pushed the enh/split_into_validators branch from 776583e to 7d92b2c Compare August 27, 2019 13:02
@rullzer rullzer merged commit d805762 into master Aug 27, 2019
@rullzer rullzer deleted the enh/split_into_validators branch August 27, 2019 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants