Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ja/last upstream code with our change #19

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
15 changes: 12 additions & 3 deletions src/FormRequestTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class FormRequestTester
*/
private $validated;


private $validationHasBeenRun = false;

/**
* Create new FormRequestTester instance
*
Expand Down Expand Up @@ -214,10 +217,14 @@ public function formRequest()
*/
public function checkFormRequest()
{
if (!is_null($this->currentFormRequest)) {
if (!is_null($this->currentFormRequest) && $this->validationHasBeenRun) {
return;
}
$this->buildFormRequest();

if (is_null($this->currentFormRequest)) {
$this->buildFormRequest();
}

$this->validateFormRequest();
}

Expand All @@ -226,7 +233,7 @@ public function checkFormRequest()
*
* @return void
*/
private function buildFormRequest()
public function buildFormRequest()
{
$this->currentFormRequest =
$this->formRequest::create($this->getRoute(), $this->method, $this->data)
Expand Down Expand Up @@ -272,6 +279,8 @@ private function validateFormRequest()
} catch (AuthorizationException $e) {
$this->formRequestAuthorized = false;
}

$this->validationHasBeenRun = true;
}

/**
Expand Down