Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Oct 25, 2023
1 parent b25570c commit 1b4df01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use EMS\FormBundle\FormConfig\FormConfig;
use EMS\FormBundle\FormConfig\SubmissionConfig;
use EMS\FormBundle\Submission\AbstractHandler;
use EMS\FormBundle\Submission\FormData;
use EMS\FormBundle\Submission\HandleRequest;
use EMS\FormBundle\Submission\HandleResponseCollector;
use EMS\FormBundle\Submission\HandleResponseInterface;
Expand Down Expand Up @@ -38,8 +39,9 @@ protected function handle(FormInterface $form, string $endpoint, string $message
{
$handler = $this->getHandler();
$submissionConfig = new SubmissionConfig($handler::class, $endpoint, $message);
$formData = new FormData($this->formConfig, $form);

$handleRequest = new HandleRequest($form, $this->formConfig, new HandleResponseCollector(), $submissionConfig);
$handleRequest = new HandleRequest($form, $this->formConfig, $formData, new HandleResponseCollector(), $submissionConfig);

return $handler->handle($handleRequest);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use EMS\FormBundle\FormConfig\FormConfig;
use EMS\FormBundle\FormConfig\SubmissionConfig;
use EMS\FormBundle\Submission\FormData;
use EMS\FormBundle\Submission\HandleRequest;
use EMS\FormBundle\Submission\HandleResponseCollector;
use EMS\SubmissionBundle\Tests\Functional\AbstractFunctionalTest;
Expand Down Expand Up @@ -37,8 +38,9 @@ protected function setUp(): void
protected function createRequest(string $handlerClass, string $endpoint, string $message): HandleRequest
{
$submissionConfig = new SubmissionConfig($handlerClass, $endpoint, $message);
$formData = new FormData($this->formConfig, $this->form);

return new HandleRequest($this->form, $this->formConfig, $this->responseCollector, $submissionConfig);
return new HandleRequest($this->form, $this->formConfig, $formData, $this->responseCollector, $submissionConfig);
}

protected function createForm(array $data = []): FormInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use EMS\FormBundle\FormConfig\SubmissionConfig;
use EMS\FormBundle\Submission\AbstractHandler;
use EMS\FormBundle\Submission\FormData;
use EMS\FormBundle\Submission\HandleRequest;
use EMS\FormBundle\Submission\HandleResponseCollector;
use EMS\SubmissionBundle\Handler\EmailHandler;
Expand Down Expand Up @@ -80,8 +81,9 @@ public function testPdfEmail(): void

$responseCollector = new HandleResponseCollector();
$responseCollector->addResponse($pdfResponse);
$formData = new FormData($this->formConfig, $form);

$emailHandleRequest = new HandleRequest($form, $this->formConfig, $responseCollector, $emailSubmission);
$emailHandleRequest = new HandleRequest($form, $this->formConfig, $formData, $responseCollector, $emailSubmission);
/** @var EmailHandleResponse $emailResponse */
$emailResponse = $emailHandler->handle($emailHandleRequest);
$attachments = $emailResponse->getMessage()->getAttachments();
Expand Down

0 comments on commit 1b4df01

Please sign in to comment.