+
+ return $this->admin;
+ }
+
+ /**
+ * Set the current user context to be an editor.
+ */
+ public function asEditor()
+ {
+ return $this->actingAs($this->getEditor());
+ }
+
+ /**
+ * Get a editor user.
+ */
+ protected function getEditor(): User
+ {
+ if ($this->editor === null) {
+ $editorRole = Role::getRole('editor');
+ $this->editor = $editorRole->users->first();
+ }
+
+ return $this->editor;
+ }
+
+ /**
+ * Set the current user context to be a viewer.
+ */
+ public function asViewer()
+ {
+ return $this->actingAs($this->getViewer());
+ }
+
+ /**
+ * Get an instance of a user with 'viewer' permissions.
+ */
+ protected function getViewer(array $attributes = []): User
+ {
+ $user = Role::getRole('viewer')->users()->first();
+ if (!empty($attributes)) {
+ $user->forceFill($attributes)->save();
+ }
+
+ return $user;
+ }
+
+ /**
+ * Get a user that's not a system user such as the guest user.
+ */
+ public function getNormalUser(): User
+ {
+ return User::query()->where('system_name', '=', null)->get()->last();