Fixed login method

This commit is contained in:
philipp lang 2021-11-17 22:44:07 +01:00
parent a50a43b9ab
commit a7d8ea6773
1 changed files with 9 additions and 14 deletions

View File

@ -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'
]
]));
}
}