X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/3368fe42d8a94bc1d819375fe54dc170e5b1d64b..refs/pull/846/head:/tests/BrowserKitTest.php diff --git a/tests/BrowserKitTest.php b/tests/BrowserKitTest.php index c665bfc23..a8ff03044 100644 --- a/tests/BrowserKitTest.php +++ b/tests/BrowserKitTest.php @@ -1,5 +1,6 @@ app[PermissionService::class]; + $restrictionService->buildJointPermissionsForEntity($entity); + } + + /** + * 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; }