From b8164cd3d204412cd3be95cbf29b9fcc3d23a77d Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 9 Mar 2024 00:13:01 +0100 Subject: [PATCH] Mod member fake --- src/Fakes/MemberFake.php | 10 +++++----- tests/Unit/Api/PutMemberTest.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Fakes/MemberFake.php b/src/Fakes/MemberFake.php index 3067967..09660dd 100644 --- a/src/Fakes/MemberFake.php +++ b/src/Fakes/MemberFake.php @@ -10,7 +10,7 @@ class MemberFake extends Fake public function fetchFails(int $groupId, int $memberId, string $error = 'wrong message'): void { Http::fake(function ($request) use ($groupId, $memberId, $error) { - $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId; + $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/' . $groupId . '/' . $memberId; if ($request->url() === $url && 'GET' === $request->method()) { return $this->errorResponse($error); } @@ -23,7 +23,7 @@ class MemberFake extends Fake public function shows(int $groupId, int $memberId, array $data = []): self { Http::fake(function ($request) use ($groupId, $memberId, $data) { - $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId; + $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/' . $groupId . '/' . $memberId; if ($request->url() === $url && 'GET' === $request->method()) { return $this->dataResponse(array_merge([ 'beitragsartId' => 1, @@ -94,7 +94,7 @@ class MemberFake extends Fake public function updatesSuccessfully(int $groupId, int $memberId, array $data = []): self { Http::fake(function ($request) use ($groupId, $memberId, $data) { - $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$groupId.'/'.$memberId; + $url = 'https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/' . $groupId . '/' . $memberId; if ($request->url() === $url && 'PUT' === $request->method()) { return $this->dataResponse([ 'id' => $memberId, @@ -106,7 +106,7 @@ class MemberFake extends Fake return $this; } - public function createsSuccessfully(int $groupId, int $memberId): self + public function stores(int $groupId, int $memberId): self { Http::fake(function ($request) use ($memberId, $groupId) { $url = "https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{$groupId}"; @@ -122,7 +122,7 @@ class MemberFake extends Fake /** * @param array $body */ - public function assertCreated(int $groupId, array $body): void + public function assertStored(int $groupId, array $body): void { Http::assertSent(function ($request) use ($groupId, $body) { $url = "https://nami.dpsg.de/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{$groupId}"; diff --git a/tests/Unit/Api/PutMemberTest.php b/tests/Unit/Api/PutMemberTest.php index 2d2853b..d7fb72d 100644 --- a/tests/Unit/Api/PutMemberTest.php +++ b/tests/Unit/Api/PutMemberTest.php @@ -10,7 +10,7 @@ class PutMemberTest extends TestCase { public function testPushASingleMember(): void { - app(MemberFake::class)->createsSuccessfully(103, 16); + app(MemberFake::class)->stores(103, 16); $member = Member::factory()->toMember([ 'firstname' => 'Max', 'lastname' => 'Nach1', @@ -43,7 +43,7 @@ class PutMemberTest extends TestCase $this->assertEquals(16, $response); - app(MemberFake::class)->assertCreated(103, [ + app(MemberFake::class)->assertStored(103, [ 'spitzname' => 'spitz1', 'vorname' => 'Max', 'nachname' => 'Nach1',