* @var string
*/
protected $baseUrl = 'http://localhost';
+
+ // Local user instances
private $admin;
+ private $editor;
/**
* Creates the application.
return $app;
}
+ /**
+ * Set the current user context to be an admin.
+ * @return $this
+ */
public function asAdmin()
{
if($this->admin === null) {
return $this->actingAs($this->admin);
}
+ /**
+ * Set the current editor context to be an editor.
+ * @return $this
+ */
+ public function asEditor()
+ {
+ if($this->editor === null) {
+ $this->editor = $this->getEditor();
+ }
+ return $this->actingAs($this->editor);
+ }
+
/**
* Quickly sets an array of settings.
* @param $settingsArray
* @param array $attributes
* @return mixed
*/
- protected function getNewUser($attributes = [])
+ protected function getEditor($attributes = [])
{
$user = factory(\BookStack\User::class)->create($attributes);
$role = \BookStack\Role::getRole('editor');