2020-04-10 20:32:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
2021-07-17 15:58:38 +02:00
|
|
|
use Illuminate\Testing\TestResponse;
|
|
|
|
use Tests\Lib\InertiaMixin;
|
2021-06-13 11:30:31 +02:00
|
|
|
use Zoomyboy\LaravelNami\FakesNami;
|
2021-07-17 15:56:37 +02:00
|
|
|
use Zoomyboy\LaravelNami\Nami;
|
2021-06-18 23:36:06 +02:00
|
|
|
use Zoomyboy\LaravelNami\NamiUser;
|
2020-04-10 20:32:12 +02:00
|
|
|
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
|
|
{
|
|
|
|
use CreatesApplication;
|
2021-06-13 11:30:31 +02:00
|
|
|
use FakesNami;
|
|
|
|
|
|
|
|
public function setUp(): void {
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->fakeNami();
|
2021-07-17 15:58:38 +02:00
|
|
|
TestResponse::mixin(new InertiaMixin());
|
2021-06-13 11:30:31 +02:00
|
|
|
}
|
|
|
|
|
2021-06-18 23:36:06 +02:00
|
|
|
public function login() {
|
|
|
|
$this->fakeNamiMembers([
|
2021-07-17 15:56:37 +02:00
|
|
|
[ 'gruppierungId' => 12399, 'vorname' => 'Max', 'nachname' => '::lastname::', 'id' => 999 ]
|
2021-06-18 23:36:06 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->fakeNamiPassword(999, 'secret', [12399]);
|
|
|
|
$api = Nami::login(999, 'secret');
|
|
|
|
|
2021-06-21 23:50:09 +02:00
|
|
|
$this->be(NamiUser::fromPayload([
|
2021-06-18 23:36:06 +02:00
|
|
|
'credentials' => [
|
|
|
|
'mglnr' => 999,
|
|
|
|
'password' => 'secret'
|
|
|
|
]
|
|
|
|
]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-10 20:32:12 +02:00
|
|
|
}
|