diff --git a/src/Fakes/ActivityFake.php b/src/Fakes/ActivityFake.php new file mode 100644 index 0000000..d5f5639 --- /dev/null +++ b/src/Fakes/ActivityFake.php @@ -0,0 +1,38 @@ + $data + */ + public function fetches(int $groupId, array $data): self + { + Http::fake(function ($request) use ($data, $groupId) { + $url = "https://nami.dpsg.de/ica/rest/nami/taetigkeitaufgruppierung/filtered/gruppierung/gruppierung/{$groupId}"; + if ($request->url() === $url && 'GET' === $request->method()) { + return $this->dataResponse($data); + } + }); + + return $this; + } + + /** + * @param array $data + */ + public function fetchesSubactivity(int $activityId, array $data): self + { + Http::fake(function ($request) use ($data, $activityId) { + $url = "https://nami.dpsg.de/ica/rest/nami/untergliederungauftaetigkeit/filtered/untergliederung/taetigkeit/{$activityId}"; + if ($request->url() === $url && 'GET' === $request->method()) { + return $this->dataResponse($data); + } + }); + + return $this; + } +}