Compare commits
No commits in common. "84103d40521d77f936635a7f992cf1ae4b01dafe" and "b8164cd3d204412cd3be95cbf29b9fcc3d23a77d" have entirely different histories.
84103d4052
...
b8164cd3d2
|
@ -9,7 +9,7 @@ class GroupFake extends Fake
|
||||||
/**
|
/**
|
||||||
* @param array<int, array{name: string}> $data
|
* @param array<int, array{name: string}> $data
|
||||||
*/
|
*/
|
||||||
public function fetches(?int $parent, array $data): self
|
public function fetches(?int $parent = null, array $data): self
|
||||||
{
|
{
|
||||||
$this->fakeResponse($parent, $data);
|
$this->fakeResponse($parent, $data);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class GroupFake extends Fake
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fakeResponse(?int $parentId, array $data): void
|
private function fakeResponse(?int $parentId = null, array $data): void
|
||||||
{
|
{
|
||||||
$url = 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/'.($parentId ?: 'root');
|
$url = 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/'.($parentId ?: 'root');
|
||||||
Http::fake(function ($request) use ($data, $url) {
|
Http::fake(function ($request) use ($data, $url) {
|
||||||
|
@ -52,16 +52,14 @@ class GroupFake extends Fake
|
||||||
|
|
||||||
public function assertRootFetched(): void
|
public function assertRootFetched(): void
|
||||||
{
|
{
|
||||||
Http::assertSent(
|
Http::assertSent(fn ($request) => 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/root' === $request->url()
|
||||||
fn ($request) => 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/root' === $request->url()
|
|
||||||
&& 'GET' === $request->method()
|
&& 'GET' === $request->method()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function assertFetched(int $id): void
|
public function assertFetched(int $id): void
|
||||||
{
|
{
|
||||||
Http::assertSent(
|
Http::assertSent(fn ($request) => $request->url() === 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/'.$id
|
||||||
fn ($request) => $request->url() === 'https://nami.dpsg.de/ica/rest/nami/gruppierungen/filtered-for-navigation/gruppierung/node/' . $id
|
|
||||||
&& 'GET' === $request->method()
|
&& 'GET' === $request->method()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue