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
@@ -72,8 +72,8 @@ class TestControllerTest extends WebTestCase
|
||||
$this->assertResponseIsSuccessful();
|
||||
$this->assertStringContainsString('Testmodus', $crawler->text());
|
||||
// the assignment has no escort, so the questionnaire comes without the bus part
|
||||
$this->assertStringContainsString('Ohne die Fragen zur Busfahrt', $crawler->text());
|
||||
$this->assertCount(0, $crawler->filter('[data-question-key="bus_company"]'));
|
||||
$this->assertStringContainsString('Ohne das Bus-Feedback', $crawler->text());
|
||||
$this->assertCount(0, $crawler->filter('[data-question-key="bus_feedback.bus_company"]'));
|
||||
$this->assertCount(1, $crawler->filter('form[data-controller="questionnaire"]'));
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ class TestControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('ROLE_TEAM_ADMIN'));
|
||||
$form = $this->open()->selectButton('Entwurf speichern')->form();
|
||||
$form['questionnaire[improvement][wished_differently]'] = 'Mehr Schnee';
|
||||
$form['questionnaire[teamer_feedback][improvement][wished_differently]'] = 'Mehr Schnee';
|
||||
$crawler = $this->client->submit($form);
|
||||
|
||||
$this->assertStringContainsString('Der Entwurf wäre jetzt gespeichert', $crawler->text());
|
||||
$this->assertSame('Mehr Schnee', $crawler->filter('textarea[name="questionnaire[improvement][wished_differently]"]')->text());
|
||||
$this->assertSame('Mehr Schnee', $crawler->filter('textarea[name="questionnaire[teamer_feedback][improvement][wished_differently]"]')->text());
|
||||
$this->assertNothingSaved();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class TestControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('ROLE_TEAM_ADMIN'));
|
||||
$form = $this->open()->selectButton('Absenden')->form();
|
||||
$definition = self::getContainer()->get(QuestionnaireCatalog::class)->get(QuestionnaireCatalog::TEAMER_ASSIGNMENT)->forFlags([]);
|
||||
$definition = self::getContainer()->get(QuestionnaireCatalog::class)->get(QuestionnaireCatalog::TEAMER_FEEDBACK);
|
||||
|
||||
foreach ($definition->sections as $section) {
|
||||
foreach ($section->questions as $question) {
|
||||
@@ -112,7 +112,7 @@ class TestControllerTest extends WebTestCase
|
||||
continue;
|
||||
}
|
||||
|
||||
$form[sprintf('questionnaire[%s][%s]', $section->key, $question->key)] = match ($question->type) {
|
||||
$form[sprintf('questionnaire[%s][%s][%s]', $definition->key, $section->key, $question->key)] = match ($question->type) {
|
||||
QuestionType::CHOICE => $question->options[0]->key,
|
||||
QuestionType::RATING => '5',
|
||||
default => 'Antwort',
|
||||
@@ -132,8 +132,8 @@ class TestControllerTest extends WebTestCase
|
||||
$this->client->loginUser($this->user('ROLE_TEAM_ADMIN'));
|
||||
$crawler = $this->client->request('GET', sprintf('/administrative/questionnaire/test/%s?bus_escort=1', $this->assignment->getUuid()));
|
||||
|
||||
$this->assertStringContainsString('Mit den Fragen zur Busfahrt', $crawler->text());
|
||||
$this->assertCount(1, $crawler->filter('[data-question-key="bus_company"]'));
|
||||
$this->assertStringContainsString('Mit dem Bus-Feedback', $crawler->text());
|
||||
$this->assertCount(1, $crawler->filter('[data-question-key="bus_feedback.bus_company"]'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user