Addressed test failures from users API changes

This commit is contained in:
Dan Brown 2022-02-04 01:02:13 +00:00
parent 46e6e239dc
commit c8be6ee8a6
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
5 changed files with 9 additions and 5 deletions

View File

@ -192,7 +192,7 @@ class UserRepo
*/
public function create(array $data, bool $sendInvite = false): User
{
$user = $this->createWithoutActivity($data, false);
$user = $this->createWithoutActivity($data, true);
if ($sendInvite) {
$this->inviteService->sendInvitation($user);

View File

@ -39,6 +39,11 @@ class NotifyException extends Exception implements Responsable
{
$message = $this->getMessage();
// Front-end JSON handling. API-side handling managed via handler.
if ($request->wantsJson()) {
return response()->json(['error' => $message], 403);
}
if (!empty($message)) {
session()->flash('error', $message);
}

View File

@ -140,6 +140,7 @@ class UserController extends Controller
'language' => ['string'],
'roles' => ['array'],
'roles.*' => ['integer'],
'external_auth_id' => ['string'],
'profile_image' => array_merge(['nullable'], $this->getImageValidationRules()),
]);

View File

@ -45,9 +45,7 @@ class UserInviteTest extends TestCase
'name' => 'Barry',
'email' => $email,
'send_invite' => 'true',
'setting' => [
'language' => 'de',
],
'language' => 'de',
]);
$resp->assertRedirect('/settings/users');

View File

@ -189,7 +189,7 @@ class UserManagementTest extends TestCase
foreach ($langs as $lang) {
config()->set('app.locale', $lang);
$resp = $this->asAdmin()->get('/settings/users/create');
$resp->assertElementExists('select[name="setting[language]"] option[value="' . $lang . '"][selected]');
$resp->assertElementExists('select[name="language"] option[value="' . $lang . '"][selected]');
}
}