From 33875d36fa5bd6fab4147e95f4aa705092f42d93 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Mon, 8 May 2023 14:49:54 +0200 Subject: [PATCH] Add searchTest for general search --- tests/Unit/SearchTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/Unit/SearchTest.php b/tests/Unit/SearchTest.php index ef6c507..9f012a4 100644 --- a/tests/Unit/SearchTest.php +++ b/tests/Unit/SearchTest.php @@ -52,11 +52,19 @@ class SearchTest extends TestCase $this->assertEquals(89418, $member->id); $this->assertEquals(100105, $member->groupId); $this->assertEquals(90166, $member->memberId); - Http::assertSent(function ($request) { - return $request->url() == $this->url(['mitgliedsNummber' => 150]) - && 'GET' == $request->method(); - }); + app(SearchFake::class)->assertFetched(1, 0, 100, ['mitgliedsNummber' => 150]); + Http::assertSentCount(1); + } + public function testItFindsMembersByGeneralSearch(): void + { + Http::fake([ + $this->url(['data' => 'A']) => Http::response($this->fakeJson('searchResponse.json'), 200), + ]); + + $member = $this->login()->find(['data' => 'A']); + + app(SearchFake::class)->assertFetched(1, 0, 100, ['data' => 'A']); Http::assertSentCount(1); }