Skip to content

Commit 649d708

Browse files
committed
fixup! fix integration tests
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent b3ff6ca commit 649d708

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

tests/Integration/Api/ApiV3Test.php

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,86 +1062,65 @@ public function dataGetSubmissions() {
10621062
'expected' => [
10631063
'submissions' => [
10641064
[
1065-
// 'formId' => Checked dynamically
10661065
'userId' => 'user1',
10671066
'userDisplayName' => 'User No. 1',
10681067
'timestamp' => 123456,
10691068
'answers' => [
10701069
[
1071-
// 'submissionId' => Checked dynamically
1072-
// 'questionId' => Checked dynamically
10731070
'text' => 'This is a short answer.',
10741071
'fileId' => null,
10751072
],
10761073
[
1077-
// 'submissionId' => Checked dynamically
1078-
// 'questionId' => Checked dynamically
10791074
'text' => 'Option 1',
10801075
'fileId' => null,
10811076
'questionName' => 'city',
10821077
],
10831078
[
1084-
// 'submissionId' => Checked dynamically
1085-
// 'questionId' => Checked dynamically
10861079
'text' => '',
10871080
'fileId' => null,
10881081
],
10891082
],
10901083
],
10911084
[
1092-
// 'formId' => Checked dynamically
10931085
'userId' => 'user2',
10941086
'userDisplayName' => 'user2',
10951087
'timestamp' => 12345,
10961088
'answers' => [
10971089
[
1098-
// 'submissionId' => Checked dynamically
1099-
// 'questionId' => Checked dynamically
11001090
'text' => 'This is another short answer.',
11011091
'fileId' => null,
11021092
],
11031093
[
1104-
// 'submissionId' => Checked dynamically
1105-
// 'questionId' => Checked dynamically
11061094
'text' => 'Option 2',
11071095
'fileId' => null,
11081096
'questionName' => 'city',
11091097
],
11101098
[
1111-
// 'submissionId' => Checked dynamically
1112-
// 'questionId' => Checked dynamically
11131099
'text' => '',
11141100
'fileId' => null,
11151101
],
11161102
],
11171103
],
11181104
[
1119-
// 'formId' => Checked dynamically
11201105
'userId' => 'user3',
11211106
'userDisplayName' => 'user3',
11221107
'timestamp' => 1234,
11231108
'answers' => [
11241109
[
1125-
// 'submissionId' => Checked dynamically
1126-
// 'questionId' => Checked dynamically
11271110
'text' => '',
11281111
'fileId' => null,
11291112
],
11301113
[
1131-
// 'submissionId' => Checked dynamically
1132-
// 'questionId' => Checked dynamically
11331114
'text' => '',
11341115
'fileId' => null,
11351116
'questionName' => 'city',
11361117
],
11371118
[
1138-
// 'submissionId' => Checked dynamically
1139-
// 'questionId' => Checked dynamically
11401119
'text' => '',
11411120
'fileId' => null,
11421121
],
11431122
],
1144-
]
1123+
],
11451124
],
11461125
'questions' => $this->dataGetFullForm()['getFullForm']['expected']['questions'],
11471126
'filteredSubmissionsCount' => 3,
@@ -1290,9 +1269,28 @@ public function testDeleteSubmissions(array $submissionsExpected) {
12901269
public function dataNewSubmission() {
12911270
$submissionsExpected = $this->dataGetSubmissions()['getSubmissions']['expected'];
12921271
$submissionsExpected['submissions'][] = [
1293-
'userId' => 'test'
1272+
'userId' => 'test',
1273+
'userDisplayName' => 'Test Displayname',
1274+
'formId' => null, // will be set dynamically
1275+
'answers' => [
1276+
[
1277+
'questionId' => null, // will be set dynamically
1278+
'text' => 'ShortAnswer!',
1279+
'fileId' => null,
1280+
],
1281+
[
1282+
'questionId' => null, // will be set dynamically
1283+
'text' => 'Option 1',
1284+
'fileId' => null,
1285+
'questionName' => 'city',
1286+
],
1287+
[
1288+
'questionId' => null, // will be set dynamically
1289+
'text' => 'test.txt',
1290+
'questionName' => 'file',
1291+
],
1292+
],
12941293
];
1295-
12961294
return [
12971295
'insertSubmission' => [
12981296
'submissionsExpected' => $submissionsExpected
@@ -1386,7 +1384,13 @@ public function testNewSubmission() {
13861384
public function dataDeleteSingleSubmission() {
13871385
$submissionsExpected = $this->dataGetSubmissions()['getSubmissions']['expected'];
13881386
array_splice($submissionsExpected['submissions'], 0, 1);
1389-
1387+
foreach ($submissionsExpected['submissions'] as &$submission) {
1388+
foreach ($submission['answers'] as $key => &$answer) {
1389+
if ($key === 1) {
1390+
$answer['questionName'] = 'city';
1391+
}
1392+
}
1393+
}
13901394
return [
13911395
'deleteSingleSubmission' => [
13921396
'submissionsExpected' => $submissionsExpected

0 commit comments

Comments
 (0)