feat: list and show submitted questionnaires to the office
This commit is contained in:
1 parent
890e04f8a6
commit
a35f91ac63
15 files changed
+715
-46
No files matched your search
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Application;
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\QuestionnaireResponse;
|
||||
use App\Entity\Teamer;
|
||||
use App\Model\Questionnaire\Definition;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* Escort placements and questionnaire responses for running the questionnaire queries against
|
||||
* db_test. The using test owns $entityManager and $teamer, and rolls its transaction back.
|
||||
*
|
||||
* @property EntityManagerInterface $entityManager
|
||||
* @property Teamer $teamer
|
||||
*/
|
||||
trait QuestionnaireFixturesTrait
|
||||
{
|
||||
private function escort(string $dateTo = 'yesterday', ?Teamer $teamer = null, string $hotel = 'Schwendi'): Disposition
|
||||
{
|
||||
$destination = (new Destination())
|
||||
->setProduct('Davos Klosters - Schwendi')
|
||||
->setHotel($hotel)
|
||||
->setHotelCode('DKI')
|
||||
->setHotelBusProId(1)
|
||||
->setDateFrom(new \DateTimeImmutable($dateTo.' -7 days'))
|
||||
->setDateTo(new \DateTimeImmutable($dateTo))
|
||||
->setPickups([['busProId' => 4711, 'city' => 'Stuttgart', 'street' => 'Busbahnhof', 'time' => '21:30']])
|
||||
;
|
||||
$assignment = (new Assignment())
|
||||
->setDestination($destination)
|
||||
->setPickup(4711)
|
||||
->setStatus(Assignment::STATUS_STAFFED)
|
||||
;
|
||||
$disposition = (new Disposition(new Application($assignment, $teamer ?? $this->teamer)))
|
||||
->setStatus(Disposition::STATUS_ENDED)
|
||||
;
|
||||
|
||||
$this->entityManager->persist($destination);
|
||||
$this->entityManager->persist($assignment);
|
||||
$this->entityManager->persist($disposition);
|
||||
|
||||
return $disposition;
|
||||
}
|
||||
|
||||
private function respond(Disposition $disposition, bool $submit, string $questionnaire = QuestionnaireCatalog::TEAMER_ESCORT): QuestionnaireResponse
|
||||
{
|
||||
$definition = new Definition($questionnaire, 1, 'Beispiel', null, []);
|
||||
$response = QuestionnaireResponse::forDisposition($definition, $disposition);
|
||||
|
||||
if ($submit) {
|
||||
$response->submit($definition, [], [], new \DateTimeImmutable());
|
||||
} else {
|
||||
$response->saveDraft([], []);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user