mirror of
https://github.com/flarum/core.git
synced 2025-08-11 10:55:47 +02:00
Move integration tests to separate directory
Again, we do all of this to prepare for creating "real" test suites for each type of tests.
This commit is contained in:
37
tests/integration/RetrievesAuthorizedUsers.php
Normal file
37
tests/integration/RetrievesAuthorizedUsers.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Tests\integration;
|
||||
|
||||
use Flarum\User\User;
|
||||
|
||||
trait RetrievesAuthorizedUsers
|
||||
{
|
||||
protected $userAttributes = [
|
||||
'username' => 'normal',
|
||||
'password' => 'too-obscure',
|
||||
'email' => 'normal@machine.local'
|
||||
];
|
||||
|
||||
public function getAdminUser(): User
|
||||
{
|
||||
return User::find(1);
|
||||
}
|
||||
|
||||
public function getNormalUser(): User
|
||||
{
|
||||
return User::unguarded(function () {
|
||||
return User::firstOrCreate([
|
||||
'username' => $this->userAttributes['username']
|
||||
], $this->userAttributes);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user