refactor create freight order to return dto

This commit is contained in:
Yisroel Baum 2025-11-17 21:45:59 +02:00
parent 21216ab52f
commit f322a0f80e
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 19 additions and 5 deletions

View file

@ -42,7 +42,8 @@ class CreateFreightOrderTest extends TestCase
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [],
);
$createdFreightOrder = $this->useCase->execute($dto);
$response = $this->useCase->execute($dto);
$createdFreightOrder = $response->freightOrder;
$foundFreightOrder = $this->freightOrderRepo->find(
$createdFreightOrder->getId()
);
@ -81,7 +82,8 @@ class CreateFreightOrderTest extends TestCase
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [$carrierId],
);
$createdFreightOrder = $this->useCase->execute($dto);
$response = $this->useCase->execute($dto);
$createdFreightOrder = $response->freightOrder;
$foundCarrier = $this->carrierRepo->find($carrierId);
$this->assertEquals(
[$createdFreightOrder->getId()],
@ -113,7 +115,7 @@ class CreateFreightOrderTest extends TestCase
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [$carrierId],
);
$createdFreightOrder = $this->useCase->execute($dto);
$this->useCase->execute($dto);
$this->assertEquals(1, $this->emailer->getSentEmailCount());
}
}