Skip to content

Commit f3cbdb5

Browse files
committed
Call Form::isSubmitted() before Form::isValid()
fixes #581
1 parent a038aa7 commit f3cbdb5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Form/Handler/AuthorizeFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function process()
9292
}
9393

9494
$this->form->handleRequest($request);
95-
if (!$this->form->isValid()) {
95+
if ($this->form->isSubmitted() && $this->form->isValid() === false) {
9696
return false;
9797
}
9898

Tests/Form/Handler/AuthorizeFormHandlerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,13 @@ public function testProcessWillHandleRequestOnPost()
369369
->willReturn($this->form)
370370
;
371371

372+
$this->form
373+
->expects($this->once())
374+
->method('isSubmitted')
375+
->with()
376+
->willReturn(true)
377+
;
378+
372379
$this->form
373380
->expects($this->once())
374381
->method('isValid')
@@ -428,6 +435,13 @@ public function testProcessWillHandleRequestOnPostAndWillProcessDataIfFormIsVali
428435
->willReturn($this->form)
429436
;
430437

438+
$this->form
439+
->expects($this->once())
440+
->method('isSubmitted')
441+
->with()
442+
->willReturn(true)
443+
;
444+
431445
$this->form
432446
->expects($this->once())
433447
->method('isValid')

0 commit comments

Comments
 (0)