mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 11:38:03 +08:00
Added some basic registration testing
This commit is contained in:
parent
88049476fe
commit
e8dd7fda1f
|
@ -155,6 +155,7 @@ class AuthController extends Controller
|
|||
return redirect('/register/confirm');
|
||||
}
|
||||
|
||||
$newUser->email_confirmed = true;
|
||||
auth()->login($newUser);
|
||||
session()->flash('success', 'Thanks for signing up! You are now registered and signed in.');
|
||||
return redirect($this->redirectPath());
|
||||
|
|
|
@ -39,4 +39,4 @@ $factory->define(BookStack\Page::class, function ($faker) {
|
|||
'name' => $faker->sentence,
|
||||
'html' => '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>'
|
||||
];
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,6 +20,48 @@ class AuthTest extends TestCase
|
|||
->see('BookStack');
|
||||
}
|
||||
|
||||
public function testPublicViewing()
|
||||
{
|
||||
$settings = app('BookStack\Services\SettingService');
|
||||
$settings->put('app-public', 'true');
|
||||
$this->visit('/')
|
||||
->seePageIs('/')
|
||||
->see('Sign In');
|
||||
}
|
||||
|
||||
public function testRegistrationShowing()
|
||||
{
|
||||
// Ensure registration form is showing
|
||||
$this->setSettings(['registration-enabled' => 'true']);
|
||||
$this->visit('/login')
|
||||
->see('Sign up')
|
||||
->click('Sign up')
|
||||
->seePageIs('/register');
|
||||
}
|
||||
|
||||
public function testNormalRegistration()
|
||||
{
|
||||
$this->setSettings(['registration-enabled' => 'true']);
|
||||
$user = factory(\BookStack\User::class)->make();
|
||||
|
||||
$this->visit('/register')
|
||||
->see('Sign Up')
|
||||
->type($user->name, '#name')
|
||||
->type($user->email, '#email')
|
||||
->type($user->password, '#password')
|
||||
->press('Create Account')
|
||||
->seePageIs('/')
|
||||
->see($user->name);
|
||||
}
|
||||
|
||||
private function setSettings($settingsArray)
|
||||
{
|
||||
$settings = app('BookStack\Services\SettingService');
|
||||
foreach($settingsArray as $key => $value) {
|
||||
$settings->put($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function testLogout()
|
||||
{
|
||||
$this->asAdmin()
|
||||
|
|
Loading…
Reference in New Issue
Block a user