Skip to content

Commit 00c185b

Browse files
committed
fixed all backend tests
1 parent 01c5e15 commit 00c185b

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/Mealz/MealBundle/Tests/Controller/EventControllerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public function testJoin(): void
144144
$eventParticipationId = $eventParticipation->getId();
145145
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .'/'. $eventParticipationId;
146146
$this->client->request('POST', $url);
147-
$response = $this->client->getResponse();
148147
$this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
149148

150149
$content = json_decode($this->client->getResponse()->getContent());
@@ -179,10 +178,10 @@ public function testLeave(): void
179178
$eventParticipationId = $eventParticipation->getId();
180179

181180

182-
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .$eventParticipationId;
181+
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .'/'.$eventParticipationId;
183182
$this->client->request('POST', $url);
184183

185-
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .$eventParticipationId;
184+
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .'/'.$eventParticipationId;
186185
$this->client->request('DELETE', $url);
187186
$this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
188187

src/Mealz/MealBundle/Tests/Controller/MealAdminControllerTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testEdit(): void
154154
"-1": []
155155
},
156156
"id": ' . $createdWeek->getDays()[0]->getId() . ',
157-
"event": null,
157+
"events": {},
158158
"enabled": true,
159159
"date": {
160160
"date": "' . $date->format('Y-m-d') . ' 12:00:00.000000",
@@ -175,7 +175,7 @@ public function testEdit(): void
175175
"-1": []
176176
},
177177
"id": ' . $createdWeek->getDays()[1]->getId() . ',
178-
"event": null,
178+
"events": {},
179179
"enabled": true,
180180
"date": {
181181
"date": "' . $createdWeek->getDays()[1]->getDateTime()->format('Y-m-d') . ' 12:00:00.000000",
@@ -225,7 +225,7 @@ private function createFutureEmptyWeek(DateTime $date): void
225225
"-1": []
226226
},
227227
"id": -1,
228-
"event": null,
228+
"events": {},
229229
"enabled": true,
230230
"date": {
231231
"date": "' . $localDate->format('Y-m-d') . ' 12:00:00.000000",
@@ -242,7 +242,7 @@ private function createFutureEmptyWeek(DateTime $date): void
242242
"-1": []
243243
},
244244
"id": -2,
245-
"events": null,
245+
"events": {},
246246
"enabled": true,
247247
"date": {
248248
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
@@ -260,7 +260,7 @@ private function createFutureEmptyWeek(DateTime $date): void
260260
"-1": []
261261
},
262262
"id": -3,
263-
"events": null,
263+
"events": {},
264264
"enabled": true,
265265
"date": {
266266
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
@@ -278,7 +278,7 @@ private function createFutureEmptyWeek(DateTime $date): void
278278
"-1": []
279279
},
280280
"id": -4,
281-
"events": null,
281+
"events": {},
282282
"enabled": true,
283283
"date": {
284284
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
@@ -296,7 +296,14 @@ private function createFutureEmptyWeek(DateTime $date): void
296296
"-1": []
297297
},
298298
"id": -5,
299-
"events": ' . $testEvent->getId() . ',
299+
"events": {
300+
"3": {
301+
"eventId": ' . $testEvent->getId() . ',
302+
"eventSlug": "' . $testEvent->getSlug() . '",
303+
"eventTitle": "' . $testEvent->getTitle() . '",
304+
"isPublic": ' . ($testEvent->isPublic() ? 'true' : 'false') . '
305+
}
306+
},
300307
"enabled": true,
301308
"date": {
302309
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
@@ -316,5 +323,6 @@ private function createFutureEmptyWeek(DateTime $date): void
316323

317324
// Request
318325
$this->client->request('POST', $routeStr, [], [], [], $weekJson);
326+
https://meals.test/api/weeks/2024W40
319327
}
320328
}

src/Mealz/MealBundle/Tests/Controller/MealGuestControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testnewGuestEventInvitation(): void
4242
{
4343
$guestInvitationRepo = self::getContainer()->get(GuestInvitationRepository::class);
4444
$eventParticipation = $this->createFutureEvent();
45-
$url = '/event/invitation/' . $eventParticipation->getDay()->getId() . $eventParticipation->getId();
45+
$url = '/event/invitation/' . $eventParticipation->getDay()->getId() .'/'. $eventParticipation->getId();
4646

4747
$this->client->request('GET', $url);
4848
$response = $this->client->getResponse();
@@ -56,7 +56,7 @@ public function testnewGuestEventInvitation(): void
5656
$this->assertNotNull($invitation);
5757
$this->assertEquals(
5858
$eventParticipation->getEvent()->getTitle(),
59-
$invitation->getDay()->getEventParticipation()->getEvent()->getTitle()
59+
$invitation->getEventParticipation()->getEvent()->getTitle()
6060
);
6161
}
6262

0 commit comments

Comments
 (0)