use BookStack\Auth\User;
use BookStack\Notifications\UserInvite;
use Carbon\Carbon;
+use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Str;
]);
}
+ public function test_user_invite_sent_in_selected_language()
+ {
+ Notification::fake();
+ $admin = $this->getAdmin();
+
+ $email = Str::random(16) . '@example.com';
+ $resp = $this->actingAs($admin)->post('/settings/users/create', [
+ 'name' => 'Barry',
+ 'email' => $email,
+ 'send_invite' => 'true',
+ 'language' => 'de',
+ ]);
+ $resp->assertRedirect('/settings/users');
+
+ $newUser = User::query()->where('email', '=', $email)->orderBy('id', 'desc')->first();
+ Notification::assertSentTo($newUser, UserInvite::class, function ($notification, $channels, $notifiable) {
+ /** @var MailMessage $mail */
+ $mail = $notification->toMail($notifiable);
+
+ return 'Du wurdest eingeladen BookStack beizutreten!' === $mail->subject &&
+ 'Ein Konto wurde für Sie auf BookStack erstellt.' === $mail->greeting;
+ });
+ }
+
public function test_invite_set_password()
{
Notification::fake();
$setPasswordResp = $this->followingRedirects()->post('/register/invite/' . $token, [
'password' => 'my test password',
]);
- $setPasswordResp->assertSee('Password set, you now have access to BookStack!');
+ $setPasswordResp->assertSee('Password set, you should now be able to login using your set password to access BookStack!');
$newPasswordValid = auth()->validate([
'email' => $user->email,
'password' => 'my test password',