]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Added initial translation into German (formal)
[bookstack] / tests / TestCase.php
index 4c2893f4e7d43ce8f0c85850ba078cce81658bc0..d3620eae0b9d1d985d8baaa988ca69c49c52a5f8 100644 (file)
@@ -39,11 +39,19 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
      */
     public function asAdmin()
     {
+        return $this->actingAs($this->getAdmin());
+    }
+
+    /**
+     * Get the current admin user.
+     * @return mixed
+     */
+    public function getAdmin() {
         if($this->admin === null) {
             $adminRole = \BookStack\Role::getRole('admin');
             $this->admin = $adminRole->users->first();
         }
-        return $this->actingAs($this->admin);
+        return $this->admin;
     }
 
     /**
@@ -58,6 +66,14 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
         return $this->actingAs($this->editor);
     }
 
+    /**
+     * Get a user that's not a system user such as the guest user.
+     */
+    public function getNormalUser()
+    {
+        return \BookStack\User::where('system_name', '=', null)->get()->last();
+    }
+
     /**
      * Quickly sets an array of settings.
      * @param $settingsArray