Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Console/User/RestoreTest.php
- This file was moved from src/tests/Feature/Console/UserRestoreTest.php.
<?php | <?php | ||||
namespace Tests\Feature\Console; | namespace Tests\Feature\Console\User; | ||||
use Illuminate\Support\Facades\Queue; | use Illuminate\Support\Facades\Queue; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class UserRestoreTest extends TestCase | class RestoreTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
Show All 39 Lines | public function testHandle(): void | ||||
$entitlements = $wallet->entitlements->pluck('id')->all(); | $entitlements = $wallet->entitlements->pluck('id')->all(); | ||||
$this->assertCount(8, $entitlements); | $this->assertCount(8, $entitlements); | ||||
// Non-deleted user | // Non-deleted user | ||||
$code = \Artisan::call("user:restore {$user->email}"); | $code = \Artisan::call("user:restore {$user->email}"); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
$this->assertSame(1, $code); | $this->assertSame(1, $code); | ||||
$this->assertSame("The user is not yet deleted.", $output); | $this->assertSame("The user is not deleted.", $output); | ||||
$user->delete(); | $user->delete(); | ||||
$this->assertTrue($user->trashed()); | $this->assertTrue($user->trashed()); | ||||
$this->assertTrue($domain->fresh()->trashed()); | $this->assertTrue($domain->fresh()->trashed()); | ||||
// Deleted user | // Deleted user | ||||
$code = \Artisan::call("user:restore {$user->email}"); | $code = \Artisan::call("user:restore {$user->email}"); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
$this->assertSame(0, $code); | $this->assertSame(0, $code); | ||||
$this->assertSame("", $output); | $this->assertSame("", $output); | ||||
$this->assertFalse($user->fresh()->trashed()); | $this->assertFalse($user->fresh()->trashed()); | ||||
$this->assertFalse($domain->fresh()->trashed()); | $this->assertFalse($domain->fresh()->trashed()); | ||||
} | } | ||||
} | } |