Fixes: AuthController session error merging and StatsTest
This commit is contained in:
parent
ae0816ce8d
commit
810068dcf8
|
@ -88,7 +88,7 @@ class AuthController extends BaseController
|
|||
$user = $this->auth->authenticate($data['login'], $data['password']);
|
||||
|
||||
if (!$user instanceof User) {
|
||||
$this->session->set('errors', $this->session->get('errors', []) + ['auth.not-found']);
|
||||
$this->session->set('errors', array_merge($this->session->get('errors', []), ['auth.not-found']));
|
||||
|
||||
return $this->showLogin();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ use Engelsystem\Models\User\Settings;
|
|||
use Engelsystem\Models\User\User;
|
||||
use Engelsystem\Test\Unit\HasDatabase;
|
||||
use Engelsystem\Test\Unit\TestCase;
|
||||
use Illuminate\Support\Collection;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
@ -66,6 +65,7 @@ class AuthControllerTest extends TestCase
|
|||
$session = new Session(new MockArraySessionStorage());
|
||||
/** @var Validator|MockObject $validator */
|
||||
$validator = new Validator();
|
||||
$session->set('errors', [['bar' => 'some.bar.error']]);
|
||||
|
||||
$user = new User([
|
||||
'name' => 'foo',
|
||||
|
@ -89,7 +89,7 @@ class AuthControllerTest extends TestCase
|
|||
|
||||
$response->expects($this->once())
|
||||
->method('withView')
|
||||
->with('pages/login', ['errors' => Collection::make(['auth.not-found'])])
|
||||
->with('pages/login', ['errors' => collect(['some.bar.error', 'auth.not-found'])])
|
||||
->willReturn($response);
|
||||
$response->expects($this->once())
|
||||
->method('redirectTo')
|
||||
|
|
|
@ -155,8 +155,8 @@ class StatsTest extends TestCase
|
|||
$this->initDatabase();
|
||||
$this->addUsers();
|
||||
|
||||
(new PasswordReset(['use_id' => 1, 'token' => 'loremIpsum123']))->save();
|
||||
(new PasswordReset(['use_id' => 3, 'token' => '5omeR4nd0mTok3N']))->save();
|
||||
(new PasswordReset(['user_id' => 1, 'token' => 'loremIpsum123']))->save();
|
||||
(new PasswordReset(['user_id' => 3, 'token' => '5omeR4nd0mTok3N']))->save();
|
||||
|
||||
$stats = new Stats($this->database);
|
||||
$this->assertEquals(2, $stats->passwordResets());
|
||||
|
|
Loading…
Reference in New Issue