Add loginTest

This commit is contained in:
philipp lang 2021-06-13 15:41:51 +02:00
parent dc971499f6
commit b5f3daff63
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use Illuminate\Support\Facades\Cache;
class LoginTest extends TestCase
{
/**
* A basic feature test example.
*
* @return void
*/
public function test_it_stores_login_cookie()
{
$this->withoutExceptionHandling();
$this->fakeNamiMembers([
[ 'gruppierungId' => 11222, 'vorname' => 'Max', 'id' => 123 ]
]);
$this->fakeNamiPassword(123, 'secret', [11222]);
$this->post('/login', [
'groupid' => 11222,
'mglnr' => 123,
'password' => 'secret'
]);
$cache = Cache::get('namicookie-123');
$this->assertEquals('JSESSIONID', data_get($cache, 'cookie.0.Name'));
$this->assertEquals('123', data_get($cache, 'data.mitgliedsnr'));
}
}