]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/UserInviteTest.php
Fixed OIDC Logout
[bookstack] / tests / Auth / UserInviteTest.php
index 5b9b14e60a904626bb0f0a4f935e5e337f954be7..8d6143877d3529d9532df40586c61f6c5c0b7380 100644 (file)
@@ -2,9 +2,9 @@
 
 namespace Tests\Auth;
 
-use BookStack\Auth\Access\UserInviteService;
-use BookStack\Auth\User;
+use BookStack\Access\UserInviteService;
 use BookStack\Notifications\UserInvite;
+use BookStack\Users\Models\User;
 use Carbon\Carbon;
 use Illuminate\Notifications\Messages\MailMessage;
 use Illuminate\Support\Facades\DB;
@@ -17,12 +17,12 @@ class UserInviteTest extends TestCase
     public function test_user_creation_creates_invite()
     {
         Notification::fake();
-        $admin = $this->getAdmin();
+        $admin = $this->users->admin();
 
         $email = Str::random(16) . '@example.com';
         $resp = $this->actingAs($admin)->post('/settings/users/create', [
-            'name' => 'Barry',
-            'email' => $email,
+            'name'        => 'Barry',
+            'email'       => $email,
             'send_invite' => 'true',
         ]);
         $resp->assertRedirect('/settings/users');
@@ -38,16 +38,14 @@ class UserInviteTest extends TestCase
     public function test_user_invite_sent_in_selected_language()
     {
         Notification::fake();
-        $admin = $this->getAdmin();
+        $admin = $this->users->admin();
 
         $email = Str::random(16) . '@example.com';
         $resp = $this->actingAs($admin)->post('/settings/users/create', [
-            'name' => 'Barry',
-            'email' => $email,
+            'name'        => 'Barry',
+            'email'       => $email,
             'send_invite' => 'true',
-            'setting' => [
-                'language' => 'de',
-            ]
+            'language'    => 'de',
         ]);
         $resp->assertRedirect('/settings/users');
 
@@ -55,7 +53,8 @@ class UserInviteTest extends TestCase
         Notification::assertSentTo($newUser, UserInvite::class, function ($notification, $channels, $notifiable) {
             /** @var MailMessage $mail */
             $mail = $notification->toMail($notifiable);
-            return 'Du wurdest eingeladen BookStack beizutreten!' === $mail->subject &&
+
+            return 'Sie wurden eingeladen, BookStack beizutreten!' === $mail->subject &&
                 'Ein Konto wurde für Sie auf BookStack erstellt.' === $mail->greeting;
         });
     }
@@ -63,7 +62,7 @@ class UserInviteTest extends TestCase
     public function test_invite_set_password()
     {
         Notification::fake();
-        $user = $this->getViewer();
+        $user = $this->users->viewer();
         $inviteService = app(UserInviteService::class);
 
         $inviteService->sendInvitation($user);
@@ -80,7 +79,7 @@ class UserInviteTest extends TestCase
         ]);
         $setPasswordResp->assertSee('Password set, you should now be able to login using your set password to access BookStack!');
         $newPasswordValid = auth()->validate([
-            'email' => $user->email,
+            'email'    => $user->email,
             'password' => 'my test password',
         ]);
         $this->assertTrue($newPasswordValid);
@@ -92,7 +91,7 @@ class UserInviteTest extends TestCase
     public function test_invite_set_has_password_validation()
     {
         Notification::fake();
-        $user = $this->getViewer();
+        $user = $this->users->viewer();
         $inviteService = app(UserInviteService::class);
 
         $inviteService->sendInvitation($user);
@@ -127,7 +126,7 @@ class UserInviteTest extends TestCase
     public function test_token_expires_after_two_weeks()
     {
         Notification::fake();
-        $user = $this->getViewer();
+        $user = $this->users->viewer();
         $inviteService = app(UserInviteService::class);
 
         $inviteService->sendInvitation($user);