Skip to content

Commit

Permalink
Fix errors when using rules in validation array (#592)
Browse files Browse the repository at this point in the history
Fix errors when using rules in validation array
  • Loading branch information
stayallive authored Dec 9, 2019
2 parents 9f919b8 + 9d1479a commit a52f5a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Former/Former.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ public function withRules()
}

foreach ($expFieldRules as $rule) {
if (is_object($rule)) {
continue;
}

$parameters = null;

Expand Down
11 changes: 11 additions & 0 deletions tests/LiveValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,4 +626,15 @@ public function testNoMaxFileOnSecondFile()
$this->assertHTML($hiddenMaxSizeMatcher1, $input1);
$this->assertNotHTML($hiddenMaxSizeMatcher2, $input2);
}

public function testCanIgnoreValidationRuleClasses()
{
$this->former->withRules(array('foo' => array('required', new \stdClass())));

$input = $this->former->text('foo')->__toString();
$matcher = $this->matchField();

$this->assertHTML($matcher, $input);
$this->assertControlGroup($input);
}
}

0 comments on commit a52f5a9

Please sign in to comment.