Fixed membership fake

This commit is contained in:
philipp lang 2022-03-05 22:35:58 +01:00
parent a4d8a2aefb
commit b4f1972162
3 changed files with 17 additions and 4 deletions

View File

@ -284,7 +284,8 @@ class Api {
} }
} }
public function member($groupId, $memberId) { public function member(int $groupId, int $memberId): array
{
$this->assertLoggedIn(); $this->assertLoggedIn();
$url = $this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId; $url = $this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId;
$response = $this->http()->get($url); $response = $this->http()->get($url);

View File

@ -17,4 +17,16 @@ class MemberFake extends Fake {
}); });
} }
public function shows(int $groupId, int $memberId, array $data): void
{
Http::fake(function($request) use ($groupId, $memberId, $data) {
$url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId;
if ($request->url() === $url && $request->method() === 'GET') {
return $this->dataResponse(array_merge([
], $data));
}
});
}
} }

View File

@ -124,9 +124,9 @@ class MembershipFake extends Fake {
if ( if (
data_get($request, 'gruppierungId') !== data_get($payload, 'gruppierungId') data_get($request, 'gruppierungId') !== data_get($payload, 'gruppierungId')
&& data_get($request, 'id') !== data_get($payload, 'id') || data_get($request, 'id') !== data_get($payload, 'id')
&& data_get($request, 'taetigkeitId') !== data_get($payload, 'taetigkeitId') || data_get($request, 'taetigkeitId') !== data_get($payload, 'taetigkeitId')
&& data_get($request, 'untergliederungId') !== data_get($payload, 'untergliederungId') || data_get($request, 'untergliederungId') !== data_get($payload, 'untergliederungId')
) { ) {
return false; return false;
} }