Add unit tests for user management commands

This commit is contained in:
Dane Everitt 2017-09-16 01:45:56 -05:00
parent 22459a877a
commit 12ba96bd42
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 300 additions and 41 deletions

View file

@ -79,14 +79,14 @@ class DeleteUserCommand extends Command
$results = $this->repository->search($search)->all();
if (count($results) < 1) {
$this->error(trans('command/messages.user.no_users_found'));
if (! $this->option('no-interaction')) {
if ($this->input->isInteractive()) {
return $this->handle();
}
return false;
}
if (! $this->option('no-interaction')) {
if ($this->input->isInteractive()) {
$tableValues = [];
foreach ($results as $user) {
$tableValues[] = [$user->id, $user->email, $user->name];
@ -106,7 +106,7 @@ class DeleteUserCommand extends Command
$deleteUser = $results->first();
}
if ($this->confirm(trans('command/messages.user.confirm_delete')) || $this->option('no-interaction')) {
if ($this->confirm(trans('command/messages.user.confirm_delete')) || ! $this->input->isInteractive()) {
$this->deletionService->handle($deleteUser);
$this->info(trans('command/messages.user.deleted'));
}