X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/6200948eec7c73108bd56b244729407d1751e816..refs/pull/846/head:/tests/TestCase.php diff --git a/tests/TestCase.php b/tests/TestCase.php index 81bd93ec4..5c37b6179 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -16,6 +16,12 @@ abstract class TestCase extends BaseTestCase protected $admin; protected $editor; + /** + * The base URL to use while testing the application. + * @var string + */ + protected $baseUrl = 'http://localhost'; + /** * Set the current user context to be an admin. * @return $this @@ -59,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