wip: modernized edit flow, fix insurance tier calculation
This commit is contained in:
@@ -7,7 +7,7 @@ namespace App\Tests\Service;
|
||||
use App\BusProNet\Model\Room;
|
||||
use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
@@ -38,7 +38,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$roomSelection->roomId = 1;
|
||||
$roomSelection->quantity = 2; // 2 rooms selected
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->roomSelections = [$roomSelection];
|
||||
|
||||
// Test the calculation
|
||||
@@ -70,7 +70,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$roomSelection->roomId = 2;
|
||||
$roomSelection->quantity = 1; // 1 room selected
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->roomSelections = [$roomSelection];
|
||||
|
||||
// Test the calculation
|
||||
@@ -112,7 +112,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$doubleRoomSelection->roomId = 2;
|
||||
$doubleRoomSelection->quantity = 2; // 2 double rooms
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->roomSelections = [$singleRoomSelection, $doubleRoomSelection];
|
||||
|
||||
// Test the calculation
|
||||
@@ -155,7 +155,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$roomSelection->roomId = 1;
|
||||
$roomSelection->quantity = 1;
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->roomSelections = [$roomSelection];
|
||||
|
||||
$result = $this->service->calculateRoomPricing($bookingDto);
|
||||
@@ -179,7 +179,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$roomSelection->roomId = 1;
|
||||
$roomSelection->quantity = 0; // Zero quantity - not selected
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->roomSelections = [$roomSelection];
|
||||
|
||||
$result = $this->service->calculateRoomPricing($bookingDto);
|
||||
@@ -212,7 +212,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$participant->skiPass = $skiPass;
|
||||
$participant->courses = [$course];
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$result = $this->service->calculateIndividualParticipantPrice($bookingDto, 0);
|
||||
@@ -234,7 +234,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$participant->assignedRoomId = null; // No room assigned
|
||||
$participant->skiPass = $skiPass;
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$result = $this->service->calculateIndividualParticipantPrice($bookingDto, 0);
|
||||
@@ -246,7 +246,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
public function testCalculateIndividualParticipantPriceForNonExistentParticipant(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [];
|
||||
|
||||
$result = $this->service->calculateIndividualParticipantPrice($bookingDto, 0);
|
||||
@@ -290,7 +290,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
$participant3 = new ParticipantDto();
|
||||
$participant3->assignedRoomId = null; // No room assigned
|
||||
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant1, $participant2, $participant3];
|
||||
|
||||
$result = $this->service->calculateAllParticipantIndividualPrices($bookingDto);
|
||||
@@ -308,7 +308,7 @@ class BookingPriceCalculatorServiceTest extends TestCase
|
||||
public function testCalculateAllParticipantIndividualPricesWithEmptyBooking(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [];
|
||||
|
||||
$result = $this->service->calculateAllParticipantIndividualPrices($bookingDto);
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\BusProNet\Model\Insurance;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceMatchingService;
|
||||
@@ -254,10 +254,10 @@ class InsuranceMatchingServiceTest extends TestCase
|
||||
return $participant;
|
||||
}
|
||||
|
||||
private function createBooking(string $travelDateFrom, string $travelDateTo): BookingCreateDto
|
||||
private function createBooking(string $travelDateFrom, string $travelDateTo): BookingDto
|
||||
{
|
||||
$travel = $this->createTravel($travelDateFrom, $travelDateTo);
|
||||
$booking = new BookingCreateDto($travel, 1);
|
||||
$booking = new BookingDto($travel, 1);
|
||||
|
||||
return $booking;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user