]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/UsersApiTest.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / tests / Api / UsersApiTest.php
index 6ad7272577bd3adfd8bb73056427c9fc8a7cafb7..a0c67d0d281f73612d2f2f9ada724fed833c1859 100644 (file)
@@ -143,6 +143,23 @@ class UsersApiTest extends TestCase
         Notification::assertSentTo($user, UserInviteNotification::class);
     }
 
+    public function test_create_with_send_invite_works_with_value_of_1()
+    {
+        $this->actingAsApiAdmin();
+        Notification::fake();
+
+        $resp = $this->postJson($this->baseEndpoint, [
+            'name'        => 'Benny Boris',
+            'email'       => '[email protected]',
+            'send_invite' => '1', // Submissions via x-www-form-urlencoded/form-data may use 1 instead of boolean
+        ]);
+
+        $resp->assertStatus(200);
+        /** @var User $user */
+        $user = User::query()->where('email', '=', '[email protected]')->first();
+        Notification::assertSentTo($user, UserInviteNotification::class);
+    }
+
     public function test_create_name_and_email_validation()
     {
         $this->actingAsApiAdmin();