From 64ce14910a9b43004ddb6561c64ea909bb119cee Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 20 Nov 2021 00:53:57 +0100 Subject: [PATCH] Add update error fake --- src/Fakes/CourseFake.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Fakes/CourseFake.php b/src/Fakes/CourseFake.php index 7267839..e5cf2a2 100644 --- a/src/Fakes/CourseFake.php +++ b/src/Fakes/CourseFake.php @@ -42,6 +42,15 @@ class CourseFake extends Fake { }); } + public function doesntUpdateWithError(int $memberId, int $courseId): void + { + Http::fake(function($request) use ($memberId, $courseId) { + if ($request->url() === "https://nami.dpsg.de/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/{$courseId}" && $request->method() === 'PUT') { + return Http::response('{"success":false,"data":null,"responseType":"EXCEPTION","message":"Unexpected Error javax.ejb.EJBException","title":null}', 200); + } + }); + } + /** * @param int $memberId * @param array $payload