forked from BookStackApp/BookStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users API: Fixed sending invite when using form requests
- Cast send_invite value in cases where it might not have been a boolean, which occurs on non-JSON requests. - Added test to cover. - Updated API docs to mention and shown boolean usage.
- Loading branch information
1 parent
4896c40
commit 56d07f1
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,23 @@ public function test_create_with_send_invite() | |
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(); | ||
|