Skip to content

Commit

Permalink
TestPresenterResult: assertFormHasErrors can assert error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Nov 25, 2017
1 parent 275bf8f commit 22f1ccf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/TestPresenterResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function assertFormValid(string $formName): self
}


public function assertFormHasErrors(string $formName): self
public function assertFormHasErrors(string $formName, ?array $formErrors = null): self
{
$this->responseInspected = TRUE;
$presenter = $this->getUIPresenter();
Expand All @@ -245,6 +245,10 @@ public function assertFormHasErrors(string $formName): self
assert($form instanceof Form);
Assert::true($form->hasErrors());

if ($formErrors !== null) {
Assert::same($formErrors, $form->getErrors());
}

return $this;
}

Expand Down

0 comments on commit 22f1ccf

Please sign in to comment.