Remove LoginFake

This commit is contained in:
philipp lang 2022-02-19 12:42:06 +01:00
parent 99e34e75d5
commit 15a6bcc70e
3 changed files with 1 additions and 49 deletions

View File

@ -272,11 +272,6 @@ class FakeBackend {
return $this; return $this;
} }
public function fakeFailedLogin(): void
{
app(LoginFake::class)->fails();
}
/** /**
* @param array<int, array{name: string, id: int}> $data * @param array<int, array{name: string, id: int}> $data
*/ */

View File

@ -1,39 +0,0 @@
<?php
namespace Zoomyboy\LaravelNami\Fakes;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
class LoginFake extends Fake {
public function succeeds(string $mglnr): void
{
Http::fake(function($request) use ($mglnr) {
if ($request->url() === 'https://nami.dpsg.de/ica/pages/login.jsp') {
return Http::response('', 200);
}
if ($request->url() === 'https://nami.dpsg.de/ica/rest/nami/auth/manual/sessionStartup') {
return Http::response('{"statusCode": 0}', 302)->then(function($r) use ($mglnr) {
app('nami.cookie')->set($mglnr, 'rZMBv1McDAJ-KukQ6BboJBTq.srv-nami06');
return $r;
});
}
});
}
public function fails(): void
{
Http::fake(function($request) {
if ($request->url() === 'https://nami.dpsg.de/ica/pages/login.jsp') {
return Http::response('', 200);
}
if ($request->url() === 'https://nami.dpsg.de/ica/rest/nami/auth/manual/sessionStartup') {
return Http::response('{"statusCode": 3000, "statusMessage": "Benutzer nicht gefunden oder Passwort falsch"}', 200);
}
});
}
}

View File

@ -9,7 +9,6 @@ use Illuminate\Support\ServiceProvider;
use Zoomyboy\LaravelNami\Api; use Zoomyboy\LaravelNami\Api;
use Zoomyboy\LaravelNami\Authentication\Authenticator; use Zoomyboy\LaravelNami\Authentication\Authenticator;
use Zoomyboy\LaravelNami\Authentication\MainCookie; use Zoomyboy\LaravelNami\Authentication\MainCookie;
use Zoomyboy\LaravelNami\Authentication\NamiGuard;
use Zoomyboy\LaravelNami\Backend\LiveBackend; use Zoomyboy\LaravelNami\Backend\LiveBackend;
use Zoomyboy\LaravelNami\Cookies\CacheCookie; use Zoomyboy\LaravelNami\Cookies\CacheCookie;
@ -17,10 +16,7 @@ class NamiServiceProvider extends ServiceProvider
{ {
public function boot() public function boot()
{ {
Auth::extend('nami', function ($app, $name, array $config) { //
return (new NamiGuard($this->app['session.store'], $this->app['cache.store']))
->setFallbacks(data_get($config, 'other_providers', []));
});
} }
public function register() { public function register() {