Applied latest styleci changes
This commit is contained in:
parent
033b163675
commit
9d15688a43
|
@ -101,6 +101,7 @@ class CreateAdmin extends Command
|
||||||
foreach ($this->options() as $key => $value) {
|
foreach ($this->options() as $key => $value) {
|
||||||
$returnOpts[str_replace('-', '_', $key)] = $value;
|
$returnOpts[str_replace('-', '_', $key)] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $returnOpts;
|
return $returnOpts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,8 @@ class UserController extends Controller
|
||||||
{
|
{
|
||||||
$this->checkPermission('users-manage');
|
$this->checkPermission('users-manage');
|
||||||
$validationRules = [
|
$validationRules = [
|
||||||
'name' => ['required'],
|
'name' => ['required'],
|
||||||
'email' => ['required', 'email', 'unique:users,email'],
|
'email' => ['required', 'email', 'unique:users,email'],
|
||||||
'setting' => ['array'],
|
'setting' => ['array'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ class UserInviteTest extends TestCase
|
||||||
|
|
||||||
$email = Str::random(16) . '@example.com';
|
$email = Str::random(16) . '@example.com';
|
||||||
$resp = $this->actingAs($admin)->post('/settings/users/create', [
|
$resp = $this->actingAs($admin)->post('/settings/users/create', [
|
||||||
'name' => 'Barry',
|
'name' => 'Barry',
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'send_invite' => 'true',
|
'send_invite' => 'true',
|
||||||
]);
|
]);
|
||||||
$resp->assertRedirect('/settings/users');
|
$resp->assertRedirect('/settings/users');
|
||||||
|
@ -42,12 +42,12 @@ class UserInviteTest extends TestCase
|
||||||
|
|
||||||
$email = Str::random(16) . '@example.com';
|
$email = Str::random(16) . '@example.com';
|
||||||
$resp = $this->actingAs($admin)->post('/settings/users/create', [
|
$resp = $this->actingAs($admin)->post('/settings/users/create', [
|
||||||
'name' => 'Barry',
|
'name' => 'Barry',
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'send_invite' => 'true',
|
'send_invite' => 'true',
|
||||||
'setting' => [
|
'setting' => [
|
||||||
'language' => 'de',
|
'language' => 'de',
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
$resp->assertRedirect('/settings/users');
|
$resp->assertRedirect('/settings/users');
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class UserInviteTest extends TestCase
|
||||||
Notification::assertSentTo($newUser, UserInvite::class, function ($notification, $channels, $notifiable) {
|
Notification::assertSentTo($newUser, UserInvite::class, function ($notification, $channels, $notifiable) {
|
||||||
/** @var MailMessage $mail */
|
/** @var MailMessage $mail */
|
||||||
$mail = $notification->toMail($notifiable);
|
$mail = $notification->toMail($notifiable);
|
||||||
|
|
||||||
return 'Du wurdest eingeladen BookStack beizutreten!' === $mail->subject &&
|
return 'Du wurdest eingeladen BookStack beizutreten!' === $mail->subject &&
|
||||||
'Ein Konto wurde für Sie auf BookStack erstellt.' === $mail->greeting;
|
'Ein Konto wurde für Sie auf BookStack erstellt.' === $mail->greeting;
|
||||||
});
|
});
|
||||||
|
@ -80,7 +81,7 @@ class UserInviteTest extends TestCase
|
||||||
]);
|
]);
|
||||||
$setPasswordResp->assertSee('Password set, you should now be able to login using your set password to access BookStack!');
|
$setPasswordResp->assertSee('Password set, you should now be able to login using your set password to access BookStack!');
|
||||||
$newPasswordValid = auth()->validate([
|
$newPasswordValid = auth()->validate([
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'password' => 'my test password',
|
'password' => 'my test password',
|
||||||
]);
|
]);
|
||||||
$this->assertTrue($newPasswordValid);
|
$this->assertTrue($newPasswordValid);
|
||||||
|
|
|
@ -11,14 +11,14 @@ class CreateAdminCommandTest extends TestCase
|
||||||
public function test_standard_command_usage()
|
public function test_standard_command_usage()
|
||||||
{
|
{
|
||||||
$this->artisan('bookstack:create-admin', [
|
$this->artisan('bookstack:create-admin', [
|
||||||
'--email' => 'admintest@example.com',
|
'--email' => 'admintest@example.com',
|
||||||
'--name' => 'Admin Test',
|
'--name' => 'Admin Test',
|
||||||
'--password' => 'testing-4',
|
'--password' => 'testing-4',
|
||||||
])->assertExitCode(0);
|
])->assertExitCode(0);
|
||||||
|
|
||||||
$this->assertDatabaseHas('users', [
|
$this->assertDatabaseHas('users', [
|
||||||
'email' => 'admintest@example.com',
|
'email' => 'admintest@example.com',
|
||||||
'name' => 'Admin Test',
|
'name' => 'Admin Test',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
|
@ -30,14 +30,14 @@ class CreateAdminCommandTest extends TestCase
|
||||||
public function test_providing_external_auth_id()
|
public function test_providing_external_auth_id()
|
||||||
{
|
{
|
||||||
$this->artisan('bookstack:create-admin', [
|
$this->artisan('bookstack:create-admin', [
|
||||||
'--email' => 'admintest@example.com',
|
'--email' => 'admintest@example.com',
|
||||||
'--name' => 'Admin Test',
|
'--name' => 'Admin Test',
|
||||||
'--external-auth-id' => 'xX_admin_Xx',
|
'--external-auth-id' => 'xX_admin_Xx',
|
||||||
])->assertExitCode(0);
|
])->assertExitCode(0);
|
||||||
|
|
||||||
$this->assertDatabaseHas('users', [
|
$this->assertDatabaseHas('users', [
|
||||||
'email' => 'admintest@example.com',
|
'email' => 'admintest@example.com',
|
||||||
'name' => 'Admin Test',
|
'name' => 'Admin Test',
|
||||||
'external_auth_id' => 'xX_admin_Xx',
|
'external_auth_id' => 'xX_admin_Xx',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -50,13 +50,13 @@ class CreateAdminCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
$this->artisan('bookstack:create-admin', [
|
$this->artisan('bookstack:create-admin', [
|
||||||
'--email' => 'admintest@example.com',
|
'--email' => 'admintest@example.com',
|
||||||
'--name' => 'Admin Test',
|
'--name' => 'Admin Test',
|
||||||
])->expectsQuestion('Please specify a password for the new admin user (8 characters min)', 'hunter2000')
|
])->expectsQuestion('Please specify a password for the new admin user (8 characters min)', 'hunter2000')
|
||||||
->assertExitCode(0);
|
->assertExitCode(0);
|
||||||
|
|
||||||
$this->assertDatabaseHas('users', [
|
$this->assertDatabaseHas('users', [
|
||||||
'email' => 'admintest@example.com',
|
'email' => 'admintest@example.com',
|
||||||
'name' => 'Admin Test',
|
'name' => 'Admin Test',
|
||||||
]);
|
]);
|
||||||
$this->assertTrue(Auth::attempt(['email' => 'admintest@example.com', 'password' => 'hunter2000']));
|
$this->assertTrue(Auth::attempt(['email' => 'admintest@example.com', 'password' => 'hunter2000']));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue