1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Updated to laravel 5.5

Closes #590
This commit is contained in:
Dan Brown
2017-11-19 15:56:06 +00:00
parent 65579214e2
commit 873b1099f8
23 changed files with 3371 additions and 2697 deletions

View File

@ -3,6 +3,7 @@
use BookStack\Entity;
use BookStack\Role;
use BookStack\Services\PermissionService;
use BookStack\User;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Laravel\BrowserKitTesting\TestCase;
@ -129,15 +130,25 @@ abstract class BrowserKitTest extends TestCase
}
/**
* Quick way to create a new user
* Get an instance of a user with 'editor' permissions
* @param array $attributes
* @return mixed
*/
protected function getEditor($attributes = [])
{
$user = factory(\BookStack\User::class)->create($attributes);
$role = Role::getRole('editor');
$user->attachRole($role);;
$user = \BookStack\Role::getRole('editor')->users()->first();
if (!empty($attributes)) $user->forceFill($attributes)->save();
return $user;
}
/**
* Get an instance of a user with 'viewer' permissions
* @return mixed
*/
protected function getViewer()
{
$user = \BookStack\Role::getRole('viewer')->users()->first();
if (!empty($attributes)) $user->forceFill($attributes)->save();
return $user;
}