From a7d8ea6773d87a2abe949abe903d48811a1ccebc Mon Sep 17 00:00:00 2001
From: philipp lang <philipp@aweos.de>
Date: Wed, 17 Nov 2021 22:44:07 +0100
Subject: [PATCH] Fixed login method

---
 tests/TestCase.php | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/tests/TestCase.php b/tests/TestCase.php
index f4132b5c..5997005a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -5,6 +5,7 @@ namespace Tests;
 use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
 use Illuminate\Testing\TestResponse;
 use Tests\Lib\InertiaMixin;
+use Zoomyboy\LaravelNami\Backend\FakeBackend;
 use Zoomyboy\LaravelNami\FakesNami;
 use Zoomyboy\LaravelNami\Nami;
 use Zoomyboy\LaravelNami\NamiUser;
@@ -21,21 +22,15 @@ abstract class TestCase extends BaseTestCase
         TestResponse::mixin(new InertiaMixin());
     }
 
-    public function login() {
-        $this->fakeNamiMembers([
-            [ 'gruppierungId' => 12399, 'vorname' => 'Max', 'nachname' => '::lastname::', 'id' => 999 ]
+    public function login(): void
+    {
+        app(FakeBackend::class)
+            ->fakeLogin('123')
+            ->addSearch(123, ['entries_vorname' => '::firstname::', 'entries_nachname' => '::lastname::', 'entries_gruppierungId' => 1000]);
+        $this->post('/login', [
+            'mglnr' => 123,
+            'password' => 'secret',
         ]);
-
-        $this->fakeNamiPassword(999, 'secret', [12399]);
-        $api = Nami::login(999, 'secret');
-
-        $this->be(NamiUser::fromPayload([
-            'credentials' => [
-                'mglnr' => 999,
-                'password' => 'secret'
-            ]
-        ]));
-
     }
 
 }