refactor: split the questionnaire into teamer and bus feedback
This commit is contained in:
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();
|
||||
|
||||
@@ -50,7 +50,7 @@ trait QuestionnaireFixturesTrait
|
||||
return $disposition;
|
||||
}
|
||||
|
||||
private function respond(Disposition $disposition, bool $submit, string $questionnaire = QuestionnaireCatalog::TEAMER_ASSIGNMENT): QuestionnaireResponse
|
||||
private function respond(Disposition $disposition, bool $submit, string $questionnaire = QuestionnaireCatalog::TEAMER_FEEDBACK): QuestionnaireResponse
|
||||
{
|
||||
$definition = new Definition($questionnaire, 1, 'Beispiel', null, []);
|
||||
$response = QuestionnaireResponse::forDisposition($definition, $disposition);
|
||||
|
||||
@@ -94,6 +94,6 @@ class QuestionnaireResponseRepositoryTest extends KernelTestCase
|
||||
{
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->repository->getListQuery(QuestionnaireCatalog::TEAMER_ASSIGNMENT, $filter)->getResult();
|
||||
return $this->repository->getListQuery(QuestionnaireCatalog::TEAMER_FEEDBACK, $filter)->getResult();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user