X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/1d1cc19596ac30d40a74ee751011b9bac038c47c..refs/pull/711/head:/tests/TestCase.php diff --git a/tests/TestCase.php b/tests/TestCase.php index 94751b004..5c37b6179 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -65,6 +65,18 @@ abstract class TestCase extends BaseTestCase return $this->editor; } + /** + * Get an instance of a user with 'viewer' permissions + * @param $attributes + * @return mixed + */ + protected function getViewer($attributes = []) + { + $user = \BookStack\Role::getRole('viewer')->users()->first(); + if (!empty($attributes)) $user->forceFill($attributes)->save(); + return $user; + } + /** * Create and return a new book. * @param array $input