X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/5570e858e580a66d798ff7aba18b4cc58e8ca13e..refs/pull/635/head:/tests/BrowserKitTest.php diff --git a/tests/BrowserKitTest.php b/tests/BrowserKitTest.php index c665bfc23..1eabc7417 100644 --- a/tests/BrowserKitTest.php +++ b/tests/BrowserKitTest.php @@ -1,7 +1,9 @@ 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; }