fix: ensure mandatory services are preselected in edit mode

This commit is contained in:
Björn Fromme
2026-07-10 14:33:09 +02:00
parent 4e26b8acc0
commit 99b6876ce2
4 changed files with 158 additions and 1 deletions
@@ -16,6 +16,7 @@ use App\Form\Model\ParticipantCardDataDto;
use App\Form\Model\ParticipantCardPriceDto;
use App\Model\BookingEditSubmissionResult;
use App\Service\BookingChangeTracker;
use App\Service\BookingConfigurator;
use App\Service\BookingEditContextFactory;
use App\Service\BookingEditDataLoader;
use App\Service\BookingEditDraftManager;
@@ -81,6 +82,16 @@ class IndexControllerTest extends TestCase
->method('isDraftRestored')
->willReturn(false);
$bookingSessionService = $this->createMock(BookingSessionManager::class);
$bookingSessionService->expects($this->once())
->method('saveBookingDto')
->with($request, $bookingDto, BookingDto::MODE_EDIT);
$bookingConfigurator = $this->createMock(BookingConfigurator::class);
$bookingConfigurator->expects($this->once())
->method('preselectDefaultServices')
->with($bookingDto);
$preflightChecker = $this->createMock(BookingEditPreFlightChecker::class);
$preflightChecker->expects($this->once())
->method('findMissingValueLabelsByParticipantIndex')
@@ -96,8 +107,9 @@ class IndexControllerTest extends TestCase
$controller = new TestableIndexController(
$dataLoader,
$this->createMock(BookingEditDraftManager::class),
$this->createMock(BookingSessionManager::class),
$bookingSessionService,
$fingerprintService,
$bookingConfigurator,
$contextFactory,
$preflightChecker,
$this->createMock(BookingEditSubmitter::class),
@@ -170,6 +182,7 @@ class IndexControllerTest extends TestCase
$this->createMock(BookingEditDraftManager::class),
$this->createMock(BookingSessionManager::class),
$fingerprintService,
$this->createMock(BookingConfigurator::class),
$contextFactory,
$preflightChecker,
$this->createMock(BookingEditSubmitter::class),
@@ -253,6 +266,7 @@ class IndexControllerTest extends TestCase
$this->createMock(BookingEditDraftManager::class),
$this->createMock(BookingSessionManager::class),
$fingerprintService,
$this->createMock(BookingConfigurator::class),
$contextFactory,
$preflightChecker,
$submitter,
@@ -335,6 +349,7 @@ class IndexControllerTest extends TestCase
$this->createMock(BookingEditDraftManager::class),
$this->createMock(BookingSessionManager::class),
$fingerprintService,
$this->createMock(BookingConfigurator::class),
$contextFactory,
$preflightChecker,
$submitter,
@@ -526,6 +541,7 @@ class IndexControllerTest extends TestCase
$this->createMock(BookingEditDraftManager::class),
$this->createMock(BookingSessionManager::class),
$fingerprintService,
$this->createMock(BookingConfigurator::class),
$this->createMock(BookingEditContextFactory::class),
$preflightChecker,
$submitter,
@@ -566,6 +582,7 @@ final class TestableIndexController extends IndexController
BookingEditDraftManager $draftService,
BookingSessionManager $bookingSessionService,
BookingChangeTracker $fingerprintService,
BookingConfigurator $bookingService,
BookingEditContextFactory $editContextFactory,
BookingEditPreFlightChecker $preFlightChecker,
BookingEditSubmitter $formSubmitter,
@@ -579,6 +596,7 @@ final class TestableIndexController extends IndexController
$draftService,
$bookingSessionService,
$fingerprintService,
$bookingService,
$editContextFactory,
$preFlightChecker,
$formSubmitter,