]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Updated Spanish translation
[bookstack] / tests / TestCase.php
index 81bd93ec4de41fdea805824cf22980a5ea785531..5c37b61790b83d6324f7b0d255da230dc41fbbde 100644 (file)
@@ -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