add member fake

This commit is contained in:
Philipp Lang 2022-11-14 12:59:16 +01:00
parent 9d9ed3d9aa
commit a4eede63e0
1 changed files with 27 additions and 0 deletions

View File

@ -53,6 +53,33 @@ class MemberFake extends Fake
}); });
} }
public function createsSuccessfully(int $groupId, int $memberId): void
{
Http::fake(function ($request) use ($memberId, $groupId) {
$url = "https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{$groupId}";
if ($request->url() === $url || 'POST' === $request->method()) {
return $this->idResponse($memberId);
}
});
}
/**
* @param array<string, string|int|null> $body
*/
public function assertCreated(int $groupId, array $body): void
{
Http::assertSent(function ($request) use ($groupId) {
$url = "https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{$groupId}";
if ($request->url() !== $url || 'POST' !== $request->method()) {
return false;
}
return true;
});
}
public function assertDeleted(int $memberId, Carbon $date): void public function assertDeleted(int $memberId, Carbon $date): void
{ {
Http::assertSent(function ($request) use ($memberId, $date) { Http::assertSent(function ($request) use ($memberId, $date) {