refactor: split the questionnaire into teamer and bus feedback

This commit is contained in:
fromme committed 2026-10-27 17:22:22 +01:00
1 parent 2f4f9800dd
commit a0170f5952
35 files changed
+1114 -554

No files matched your search

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Tests\Repository;
use App\Config\QuestionnaireCatalog;
use App\Entity\Assignment;
use App\Entity\Disposition;
use App\Entity\Teamer;
@@ -64,25 +65,56 @@ class DispositionRepositoryQuestionnaireTest extends KernelTestCase
$this->assertSame([['disposition' => $disposition, 'draft' => true]], $this->pending());
}
public function testASubmittedQuestionnaireIsNoLongerPending(): void
public function testAnEscortWithBothQuestionnairesSubmittedIsNoLongerPending(): void
{
$this->respond($this->escort(), submit: true);
$disposition = $this->escort();
$this->respond($disposition, submit: true);
$this->respond($disposition, submit: true, questionnaire: QuestionnaireCatalog::BUS_FEEDBACK);
$this->assertSame([], $this->pending());
}
/**
* The questionnaire key belongs in the JOIN condition: in the WHERE clause, a submitted
* response to some other questionnaire would hide this one.
* A bus escort owes both questionnaires; the teamer feedback alone does not settle it.
*/
public function testAResponseToAnotherQuestionnaireDoesNotCount(): void
public function testAnEscortWithoutTheBusFeedbackIsStillPending(): void
{
$disposition = $this->escort();
$this->respond($disposition, submit: true, questionnaire: 'other');
$this->respond($disposition, submit: true);
$this->assertSame([['disposition' => $disposition, 'draft' => false]], $this->pending());
}
public function testAnEscortWithABusFeedbackDraftSaysDraft(): void
{
$disposition = $this->escort();
$this->respond($disposition, submit: true);
$this->respond($disposition, submit: false, questionnaire: QuestionnaireCatalog::BUS_FEEDBACK);
$this->assertSame([['disposition' => $disposition, 'draft' => true]], $this->pending());
}
/**
* Each questionnaire key belongs in its JOIN condition: in the WHERE clause, the response to
* one questionnaire would stand in for the other's.
*/
public function testTheBusFeedbackDoesNotStandInForTheTeamerFeedback(): void
{
$disposition = $this->escort();
$this->respond($disposition, submit: true, questionnaire: QuestionnaireCatalog::BUS_FEEDBACK);
$this->assertSame([['disposition' => $disposition, 'draft' => false]], $this->pending());
}
public function testAPlacementWithoutBusEscortOnlyOwesTheTeamerFeedback(): void
{
$disposition = $this->escort();
$disposition->getAssignment()->setPickup(0);
$this->respond($disposition, submit: true);
$this->assertSame([], $this->pending());
}
public function testAPlacementWithoutBusEscortIsPendingToo(): void
{
$disposition = $this->escort();