wip: insurance booking
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Tests\Service;
|
||||
use App\BusProNet\Model\Insurance;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceMatchingService;
|
||||
use Carbon\Carbon;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -14,10 +15,17 @@ use PHPUnit\Framework\TestCase;
|
||||
class InsuranceMatchingServiceTest extends TestCase
|
||||
{
|
||||
private InsuranceMatchingService $service;
|
||||
private BookingPriceCalculatorService $priceCalculator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = new InsuranceMatchingService();
|
||||
// Mock the price calculator service
|
||||
$this->priceCalculator = $this->createMock(BookingPriceCalculatorService::class);
|
||||
$this->priceCalculator
|
||||
->method('calculateIndividualParticipantPriceExcludingInsurance')
|
||||
->willReturn(500.0); // Default test price
|
||||
|
||||
$this->service = new InsuranceMatchingService($this->priceCalculator);
|
||||
|
||||
// Set a fixed test date for consistent test results
|
||||
Carbon::setTestNow('2024-06-01 12:00:00');
|
||||
@@ -164,6 +172,7 @@ class InsuranceMatchingServiceTest extends TestCase
|
||||
public function testGetEligibleInsurancesHandlesParticipantWithoutBirthDate(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 0; // Set participant index for price calculations
|
||||
$participant->dateOfBirth = null;
|
||||
$booking = $this->createBooking('2024-08-01', '2024-08-08');
|
||||
|
||||
@@ -239,6 +248,7 @@ class InsuranceMatchingServiceTest extends TestCase
|
||||
private function createParticipant(string $dateOfBirth): ParticipantDto
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 0; // Set participant index for price calculations
|
||||
$participant->dateOfBirth = new \DateTimeImmutable($dateOfBirth);
|
||||
|
||||
return $participant;
|
||||
|
||||
Reference in New Issue
Block a user