Skip to content

Commit

Permalink
fixed all backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IrisOlfermann committed Sep 18, 2024
1 parent 01c5e15 commit 00c185b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/Mealz/MealBundle/Tests/Controller/EventControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public function testJoin(): void
$eventParticipationId = $eventParticipation->getId();
$url = '/api/events/participation/' . $day->getDateTime()->format('Y-m-d') . '%20' . $day->getDateTime()->format('H:i:s') .'/'. $eventParticipationId;
$this->client->request('POST', $url);
$response = $this->client->getResponse();
$this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());

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


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

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

Expand Down
22 changes: 15 additions & 7 deletions src/Mealz/MealBundle/Tests/Controller/MealAdminControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function testEdit(): void
"-1": []
},
"id": ' . $createdWeek->getDays()[0]->getId() . ',
"event": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $date->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -175,7 +175,7 @@ public function testEdit(): void
"-1": []
},
"id": ' . $createdWeek->getDays()[1]->getId() . ',
"event": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $createdWeek->getDays()[1]->getDateTime()->format('Y-m-d') . ' 12:00:00.000000",
Expand Down Expand Up @@ -225,7 +225,7 @@ private function createFutureEmptyWeek(DateTime $date): void
"-1": []
},
"id": -1,
"event": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $localDate->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -242,7 +242,7 @@ private function createFutureEmptyWeek(DateTime $date): void
"-1": []
},
"id": -2,
"events": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -260,7 +260,7 @@ private function createFutureEmptyWeek(DateTime $date): void
"-1": []
},
"id": -3,
"events": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -278,7 +278,7 @@ private function createFutureEmptyWeek(DateTime $date): void
"-1": []
},
"id": -4,
"events": null,
"events": {},
"enabled": true,
"date": {
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -296,7 +296,14 @@ private function createFutureEmptyWeek(DateTime $date): void
"-1": []
},
"id": -5,
"events": ' . $testEvent->getId() . ',
"events": {
"3": {
"eventId": ' . $testEvent->getId() . ',
"eventSlug": "' . $testEvent->getSlug() . '",
"eventTitle": "' . $testEvent->getTitle() . '",
"isPublic": ' . ($testEvent->isPublic() ? 'true' : 'false') . '
}
},
"enabled": true,
"date": {
"date": "' . $localDate->modify('+1 day')->format('Y-m-d') . ' 12:00:00.000000",
Expand All @@ -316,5 +323,6 @@ private function createFutureEmptyWeek(DateTime $date): void

// Request
$this->client->request('POST', $routeStr, [], [], [], $weekJson);
https://meals.test/api/weeks/2024W40
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testnewGuestEventInvitation(): void
{
$guestInvitationRepo = self::getContainer()->get(GuestInvitationRepository::class);
$eventParticipation = $this->createFutureEvent();
$url = '/event/invitation/' . $eventParticipation->getDay()->getId() . $eventParticipation->getId();
$url = '/event/invitation/' . $eventParticipation->getDay()->getId() .'/'. $eventParticipation->getId();

$this->client->request('GET', $url);
$response = $this->client->getResponse();
Expand All @@ -56,7 +56,7 @@ public function testnewGuestEventInvitation(): void
$this->assertNotNull($invitation);
$this->assertEquals(
$eventParticipation->getEvent()->getTitle(),
$invitation->getDay()->getEventParticipation()->getEvent()->getTitle()
$invitation->getEventParticipation()->getEvent()->getTitle()
);
}

Expand Down

0 comments on commit 00c185b

Please sign in to comment.