adrema/tests/TestCase.php

44 lines
986 B
PHP
Raw Normal View History

2020-04-10 20:32:12 +02:00
<?php
namespace Tests;
use App\Member\Member;
2020-04-10 20:32:12 +02:00
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
2021-07-17 15:58:38 +02:00
use Illuminate\Testing\TestResponse;
use Tests\Lib\InertiaMixin;
2021-11-17 22:44:07 +01:00
use Zoomyboy\LaravelNami\Backend\FakeBackend;
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
public function setUp(): void {
parent::setUp();
2021-07-17 15:58:38 +02:00
TestResponse::mixin(new InertiaMixin());
2021-06-13 11:30:31 +02:00
}
public function login(): self
2021-11-17 22:44:07 +01:00
{
app(FakeBackend::class)
->fakeLogin('123')
->addSearch(123, ['entries_vorname' => '::firstname::', 'entries_nachname' => '::lastname::', 'entries_gruppierungId' => 1000]);
$this->post('/login', [
'mglnr' => 123,
'password' => 'secret',
2021-06-18 23:36:06 +02:00
]);
return $this;
}
public function init(): self
{
Member::factory()->defaults()->create();
return $this;
2021-06-18 23:36:06 +02:00
}
2020-04-10 20:32:12 +02:00
}