feat: store questionnaire responses per disposition
This commit is contained in:
1 parent
8070fda64d
commit
df6734c939
9 files changed
+521
-1
No files matched your search
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service\Questionnaire;
|
||||
|
||||
use App\Entity\Application;
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\JobProfile;
|
||||
use App\Entity\Teamer;
|
||||
use App\Service\Questionnaire\DispositionContext;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DispositionContextTest extends TestCase
|
||||
{
|
||||
public function testEscortDispositionIsSnapshotted(): void
|
||||
{
|
||||
$context = DispositionContext::build($this->disposition(pickup: 4711));
|
||||
|
||||
$this->assertSame([
|
||||
'teamerName' => 'Kim Muster',
|
||||
'jobProfileName' => 'Reiseleitung',
|
||||
'jobProfileCategory' => JobProfile::CATEGORY_GUIDE,
|
||||
'destinationProduct' => 'Davos Klosters - Schwendi',
|
||||
'hotel' => 'Schwendi',
|
||||
'hotelCode' => 'DKI',
|
||||
'dateFrom' => '2026-01-10',
|
||||
'dateTo' => '2026-01-17',
|
||||
'escortPickup' => ['busProId' => 4711, 'city' => 'Stuttgart', 'street' => 'Busbahnhof', 'time' => '21:30'],
|
||||
// the escort leaves the evening before arrival
|
||||
'escortPickupDate' => '2026-01-09',
|
||||
], $context);
|
||||
}
|
||||
|
||||
public function testDispositionWithoutEscortHasNoPickup(): void
|
||||
{
|
||||
$context = DispositionContext::build($this->disposition(pickup: 0));
|
||||
|
||||
$this->assertNull($context['escortPickup']);
|
||||
$this->assertNull($context['escortPickupDate']);
|
||||
}
|
||||
|
||||
private function disposition(int $pickup): Disposition
|
||||
{
|
||||
$destination = (new Destination())
|
||||
->setProduct('Davos Klosters - Schwendi')
|
||||
->setHotel('Schwendi')
|
||||
->setHotelCode('DKI')
|
||||
->setDateFrom(new \DateTimeImmutable('2026-01-10'))
|
||||
->setDateTo(new \DateTimeImmutable('2026-01-17'))
|
||||
->setPickups([
|
||||
['busProId' => 4711, 'city' => 'Stuttgart', 'street' => 'Busbahnhof', 'time' => '21:30'],
|
||||
['busProId' => 4712, 'city' => 'Ulm', 'street' => 'ZOB', 'time' => '22:45'],
|
||||
])
|
||||
;
|
||||
$assignment = (new Assignment())
|
||||
->setDestination($destination)
|
||||
->setJobProfile((new JobProfile())->setName('Reiseleitung')->setCategory(JobProfile::CATEGORY_GUIDE))
|
||||
->setPickup($pickup)
|
||||
;
|
||||
$teamer = (new Teamer())->setFirstName('Kim')->setLastName('Muster');
|
||||
|
||||
return new Disposition(new Application($assignment, $teamer));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user