Fixed courses

This commit is contained in:
philipp lang 2022-08-30 23:39:02 +02:00
parent 51ac05f9d5
commit 505039a146
2 changed files with 10 additions and 2 deletions
tests

View File

@ -52,7 +52,7 @@ class StoreTest extends TestCase
*/ */
public function testItValidatesInput(array $payload, array $errors): void public function testItValidatesInput(array $payload, array $errors): void
{ {
$this->login(); $this->login()->withNamiSettings();
$member = Member::factory()->defaults()->createOne(); $member = Member::factory()->defaults()->createOne();
$course = Course::factory()->createOne(); $course = Course::factory()->createOne();

View File

@ -28,12 +28,19 @@ abstract class TestCase extends BaseTestCase
public function loginNami(int $mglnr = 12345, string $password = 'password'): self public function loginNami(int $mglnr = 12345, string $password = 'password'): self
{ {
Auth::success($mglnr, $password); 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([ NamiSettings::fake([
'mglnr' => $mglnr, 'mglnr' => $mglnr,
'password' => $password, 'password' => $password,
'default_group_id' => 55, 'default_group_id' => 55,
]); ]);
Group::factory()->create(['nami_id' => 55]);
return $this; return $this;
} }
@ -44,6 +51,7 @@ abstract class TestCase extends BaseTestCase
NamiSettings::fake([ NamiSettings::fake([
'mglnr' => $mglnr, 'mglnr' => $mglnr,
'password' => $password, 'password' => $password,
'default_group_id' => 55,
]); ]);
return $this; return $this;