X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0b364fd72f994e6dff572a1606f3aa26e7690aa1..refs/pull/139/head:/tests/TestCase.php diff --git a/tests/TestCase.php b/tests/TestCase.php index 4c2893f4e..6a8c2d732 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -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; } /**