namespace Tests\User;
-use BookStack\Actions\ActivityType;
-use BookStack\Auth\Access\UserInviteService;
-use BookStack\Auth\Role;
-use BookStack\Auth\User;
+use BookStack\Access\UserInviteService;
+use BookStack\Activity\ActivityType;
use BookStack\Uploads\Image;
+use BookStack\Users\Models\Role;
+use BookStack\Users\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Mockery\MockInterface;
$resp = $this->asEditor()->get("settings/users/{$editor->id}/delete");
$resp->assertSee('Migrate Ownership');
+ $this->withHtml($resp)->assertElementExists('form input[name="new_owner_id"]');
$resp->assertSee('new_owner_id');
}
]);
}
+ public function test_delete_with_empty_owner_migration_id_works()
+ {
+ $user = $this->users->editor();
+
+ $resp = $this->asAdmin()->delete("settings/users/{$user->id}", ['new_owner_id' => '']);
+ $resp->assertRedirect('/settings/users');
+ $this->assertActivityExists(ActivityType::USER_DELETE);
+ $this->assertSessionHas('success');
+ }
+
public function test_delete_removes_user_preferences()
{
$editor = $this->users->editor();
public function test_guest_profile_shows_limited_form()
{
- $guest = User::getDefault();
+ $guest = $this->users->guest();
$resp = $this->asAdmin()->get('/settings/users/' . $guest->id);
$resp->assertSee('Guest');
$this->withHtml($resp)->assertElementNotExists('#password');
public function test_guest_profile_cannot_be_deleted()
{
- $guestUser = User::getDefault();
+ $guestUser = $this->users->guest();
$resp = $this->asAdmin()->get('/settings/users/' . $guestUser->id . '/delete');
$resp->assertSee('Delete User');
$resp->assertSee('Guest');
{
$langs = ['en', 'fr', 'hr'];
foreach ($langs as $lang) {
- config()->set('app.locale', $lang);
+ config()->set('app.default_locale', $lang);
$resp = $this->asAdmin()->get('/settings/users/create');
$this->withHtml($resp)->assertElementExists('select[name="language"] option[value="' . $lang . '"][selected]');
}