Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* This should fix laravel#38949

* apply ci fixes
  • Loading branch information
mateusjunges authored and victorvilella committed Oct 12, 2021
1 parent b1df976 commit 15101ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Validation/Rules/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ public function symbols()
*/
public function passes($attribute, $value)
{
$this->messages = [];

$validator = Validator::make($this->data, [
$attribute => 'string|min:'.$this->min,
], $this->validator->customMessages, $this->validator->customAttributes);
Expand Down
23 changes: 23 additions & 0 deletions tests/Validation/ValidationPasswordRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,29 @@ public function testItCannotSetDefaultUsingGivenString()
Password::defaults('required|password');
}

public function testItPassesWithValidDataIfTheSameValidationRulesAreReused()
{
$rules = [
'password' => Password::default(),
];

$v = new Validator(
resolve('translator'),
['password' => '1234'],
$rules
);

$this->assertFalse($v->passes());

$v1 = new Validator(
resolve('translator'),
['password' => '12341234'],
$rules
);

$this->assertTrue($v1->passes());
}

protected function passes($rule, $values)
{
$this->assertValidationRules($rule, $values, true, []);
Expand Down

0 comments on commit 15101ba

Please sign in to comment.