]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Finished migrated from icon-font to SVG
[bookstack] / tests / TestCase.php
index 94751b0047843369a6a729b06fc7911456b1ead5..5c37b61790b83d6324f7b0d255da230dc41fbbde 100644 (file)
@@ -65,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