Skip to content

Commit

Permalink
Merge pull request #582 from scootstah/issue/581
Browse files Browse the repository at this point in the history
Call Form::isSubmitted() before Form::isValid()
  • Loading branch information
GuilhemN authored Jan 23, 2019
2 parents a038aa7 + f3cbdb5 commit fcaa25c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Form/Handler/AuthorizeFormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function process()
}

$this->form->handleRequest($request);
if (!$this->form->isValid()) {
if ($this->form->isSubmitted() && $this->form->isValid() === false) {
return false;
}

Expand Down
14 changes: 14 additions & 0 deletions Tests/Form/Handler/AuthorizeFormHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ public function testProcessWillHandleRequestOnPost()
->willReturn($this->form)
;

$this->form
->expects($this->once())
->method('isSubmitted')
->with()
->willReturn(true)
;

$this->form
->expects($this->once())
->method('isValid')
Expand Down Expand Up @@ -428,6 +435,13 @@ public function testProcessWillHandleRequestOnPostAndWillProcessDataIfFormIsVali
->willReturn($this->form)
;

$this->form
->expects($this->once())
->method('isSubmitted')
->with()
->willReturn(true)
;

$this->form
->expects($this->once())
->method('isValid')
Expand Down

0 comments on commit fcaa25c

Please sign in to comment.