fix: offer the questionnaire after every placement, the bus part to escorts
This commit is contained in:
1 parent
9fedc5b5d3
commit
2f4f9800dd
30 files changed
+311
-77
No files matched your search
@@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
|
||||
/**
|
||||
* Runs against the shipped teamer_escort definition, so a definition that parses but cannot be
|
||||
* Runs against the shipped teamer_assignment definition, so a definition that parses but cannot be
|
||||
* turned into a working form fails here.
|
||||
*
|
||||
* Every submit goes through Form::submit() with clearMissing, as a browser request does: an
|
||||
@@ -28,7 +28,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
{
|
||||
public function testEmptyDraftIsValid(): void
|
||||
{
|
||||
$form = $this->createForm($this->teamerEscort());
|
||||
$form = $this->createForm($this->teamerAssignment());
|
||||
$form->submit([QuestionnaireType::DRAFT => '']);
|
||||
|
||||
$this->assertTrue($form->isValid());
|
||||
@@ -40,7 +40,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
*/
|
||||
public function testFormSentWithoutAButtonIsADraft(): void
|
||||
{
|
||||
$form = $this->createForm($this->teamerEscort());
|
||||
$form = $this->createForm($this->teamerAssignment());
|
||||
$form->submit([]);
|
||||
|
||||
$this->assertTrue($form->isValid());
|
||||
@@ -49,7 +49,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
|
||||
public function testCompleteSubmitIsValidAndFlat(): void
|
||||
{
|
||||
$definition = $this->teamerEscort();
|
||||
$definition = $this->teamerAssignment();
|
||||
$form = $this->createForm($definition);
|
||||
$form->submit($this->complete($definition) + [QuestionnaireType::SUBMIT => '']);
|
||||
|
||||
@@ -65,7 +65,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
|
||||
public function testEmptySubmitDemandsTheVisibleRequiredQuestionsOnly(): void
|
||||
{
|
||||
$definition = $this->teamerEscort();
|
||||
$definition = $this->teamerAssignment();
|
||||
$form = $this->createForm($definition);
|
||||
$form->submit([QuestionnaireType::SUBMIT => '']);
|
||||
|
||||
@@ -79,9 +79,25 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
$this->assertCount(0, $this->field($form, 'communication', 'support_wished')->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
* A placement without bus escort gets the questionnaire without the bus sections, and can
|
||||
* submit it without them.
|
||||
*/
|
||||
public function testWithoutBusEscortTheBusPartIsNeitherShownNorDemanded(): void
|
||||
{
|
||||
$definition = $this->teamerAssignment()->forFlags([]);
|
||||
$form = $this->createForm($definition);
|
||||
|
||||
$this->assertFalse($form->has('bus_trip'));
|
||||
|
||||
$form->submit($this->complete($definition) + [QuestionnaireType::SUBMIT => '']);
|
||||
|
||||
$this->assertTrue($form->isValid(), (string) $form->getErrors(true));
|
||||
}
|
||||
|
||||
public function testLowRatingDemandsAReason(): void
|
||||
{
|
||||
$definition = $this->teamerEscort();
|
||||
$definition = $this->teamerAssignment();
|
||||
$data = $this->complete($definition);
|
||||
$data['organisation']['office_briefing_rating'] = '3';
|
||||
|
||||
@@ -95,7 +111,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
|
||||
public function testOtherBusCompanyDemandsItsName(): void
|
||||
{
|
||||
$definition = $this->teamerEscort();
|
||||
$definition = $this->teamerAssignment();
|
||||
$data = $this->complete($definition);
|
||||
$data['bus_trip']['bus_company'] = 'other';
|
||||
|
||||
@@ -111,7 +127,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
*/
|
||||
public function testNoFieldIsHtmlRequired(): void
|
||||
{
|
||||
$view = $this->createForm($this->teamerEscort())->createView();
|
||||
$view = $this->createForm($this->teamerAssignment())->createView();
|
||||
|
||||
foreach ($view as $section) {
|
||||
foreach ($section as $field) {
|
||||
@@ -122,7 +138,7 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
|
||||
public function testConditionalQuestionCarriesItsConditionForTheBrowser(): void
|
||||
{
|
||||
$view = $this->createForm($this->teamerEscort())->createView();
|
||||
$view = $this->createForm($this->teamerAssignment())->createView();
|
||||
|
||||
$row = $this->view($view, 'organisation', 'office_briefing_low_reason');
|
||||
$this->assertSame(
|
||||
@@ -159,9 +175,9 @@ class QuestionnaireTypeTest extends KernelTestCase
|
||||
$this->assertSame('2026-01-10', $form->getData()['travel_date']);
|
||||
}
|
||||
|
||||
private function teamerEscort(): Definition
|
||||
private function teamerAssignment(): Definition
|
||||
{
|
||||
return new QuestionnaireCatalog(__DIR__.'/../../config/questionnaires')->get('teamer_escort');
|
||||
return new QuestionnaireCatalog(__DIR__.'/../../config/questionnaires')->get('teamer_assignment');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user