id = 123; $bookingDto = new BookingDto($travel, 1); $bookingDto->participants = [ new \App\Form\Model\ParticipantDto(), new \App\Form\Model\ParticipantDto(), ]; $bookingData = new Booking(); $bookingData->dateId = 123; $summaryData = $this->createStub(BookingSummaryDto::class); $participantCardAssembler = $this->createMock(ParticipantCardAssembler::class); $participantCardAssembler->expects($this->once()) ->method('getAllCardsDataWithValidation') ->with($bookingDto) ->willReturn([ 0 => new ParticipantCardDataDto('One', 'one@example.com', 'Room A', new ParticipantCardPriceDto(10.0, false), false, true), 1 => new ParticipantCardDataDto('Two', 'two@example.com', 'Room B', new ParticipantCardPriceDto(20.0, false), false, true), ]); $summaryAssembler = $this->createMock(BookingSummaryAssembler::class); $summaryAssembler->expects($this->once()) ->method('getSummaryData') ->with($bookingDto) ->willReturn($summaryData); $travelDataProvider = $this->createMock(TravelDataProvider::class); $travelDataProvider->expects($this->once()) ->method('getMutabilityData') ->with(123) ->willReturn(null); $factory = new BookingEditContextFactory( $participantCardAssembler, $summaryAssembler, $travelDataProvider, ); $context = $factory->createOverviewContext( $bookingDto, $bookingData, false, false, false, [1 => ['E-Mail', 'Straße']], ); $this->assertTrue($context->cardsData[0]->isValid); $this->assertTrue($context->cardsData[1]->isValid); $this->assertSame([], $context->cardsData[1]->errorMessages); $this->assertSame([1 => ['E-Mail', 'Straße']], $context->missingValueLabelsByParticipantIndex); } }