From 505039a146a33a23f07c2a262269876c3608b98a Mon Sep 17 00:00:00 2001
From: philipp lang <philipp@aweos.de>
Date: Tue, 30 Aug 2022 23:39:02 +0200
Subject: [PATCH] Fixed courses

---
 tests/Feature/Course/StoreTest.php |  2 +-
 tests/TestCase.php                 | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/Feature/Course/StoreTest.php b/tests/Feature/Course/StoreTest.php
index 4171aa1f..1461da64 100644
--- a/tests/Feature/Course/StoreTest.php
+++ b/tests/Feature/Course/StoreTest.php
@@ -52,7 +52,7 @@ class StoreTest extends TestCase
      */
     public function testItValidatesInput(array $payload, array $errors): void
     {
-        $this->login();
+        $this->login()->withNamiSettings();
         $member = Member::factory()->defaults()->createOne();
         $course = Course::factory()->createOne();
 
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 13efdedc..b435a7f9 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -28,12 +28,19 @@ abstract class TestCase extends BaseTestCase
     public function loginNami(int $mglnr = 12345, string $password = 'password'): self
     {
         Auth::success($mglnr, $password);
+        $this->withNamiSettings($mglnr, $password);
+        Group::factory()->create(['nami_id' => 55]);
+
+        return $this;
+    }
+
+    public function withNamiSettings(int $mglnr = 12345, string $password = 'password'): self
+    {
         NamiSettings::fake([
             'mglnr' => $mglnr,
             'password' => $password,
             'default_group_id' => 55,
         ]);
-        Group::factory()->create(['nami_id' => 55]);
 
         return $this;
     }
@@ -44,6 +51,7 @@ abstract class TestCase extends BaseTestCase
         NamiSettings::fake([
             'mglnr' => $mglnr,
             'password' => $password,
+            'default_group_id' => 55,
         ]);
 
         return $this;