exemption = new SelectionBasedBodyDimensionExemption(); } public function testReturnsTrueWhenWrapperTravelContainsSelection1474(): void { $root = $this->createWrapperWithSelectionIds([1474]); $this->assertTrue($this->exemption->isBodyDimensionValidationExempt($root)); } public function testReturnsFalseWhenSelection1474IsAbsent(): void { $root = $this->createWrapperWithSelectionIds([2001]); $this->assertFalse($this->exemption->isBodyDimensionValidationExempt($root)); } public function testReturnsFalseWhenRootIsNotParticipantEditDto(): void { $this->assertFalse($this->exemption->isBodyDimensionValidationExempt(new \stdClass())); } private function createWrapperWithSelectionIds(array $selectionIds): ParticipantEditDto { $travel = new Travel(); $travel->selectionGroups = [ 1 => $this->createSelectionGroup(1, $selectionIds), ]; $bookingDto = new BookingDto($travel, 1); $participant = new ParticipantDto(); return new ParticipantEditDto( participant: $participant, bookingContext: $bookingDto, ); } /** * @param list $selectionIds */ private function createSelectionGroup(int $groupId, array $selectionIds): CrmSelectionGroup { $group = new CrmSelectionGroup(); $group->id = $groupId; $group->selections = []; foreach ($selectionIds as $selectionId) { $selection = new CrmSelection(); $selection->id = $selectionId; $group->selections[] = $selection; } return $group; } }