Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Console/User/VerifyTest.php
- This file was added.
<?php | |||||
namespace Tests\Feature\Console\User; | |||||
use Illuminate\Support\Facades\Queue; | |||||
use Tests\TestCase; | |||||
class VerifyTest extends TestCase | |||||
{ | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function setUp(): void | |||||
{ | |||||
parent::setUp(); | |||||
$this->deleteTestUser('user@force-delete.com'); | |||||
} | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function tearDown(): void | |||||
{ | |||||
$this->deleteTestUser('user@force-delete.com'); | |||||
parent::tearDown(); | |||||
} | |||||
/** | |||||
* Test the command | |||||
*/ | |||||
public function testHandle(): void | |||||
{ | |||||
Queue::fake(); | |||||
// Non-existing user | |||||
$code = \Artisan::call("user:verify unknown"); | |||||
$output = trim(\Artisan::output()); | |||||
$this->assertSame(1, $code); | |||||
$this->assertSame("User not found.", $output); | |||||
$user = $this->getTestUser('user@force-delete.com'); | |||||
// Test success | |||||
$code = \Artisan::call("user:verify {$user->email}"); | |||||
$output = trim(\Artisan::output()); | |||||
$this->assertSame(0, $code); | |||||
$this->assertSame("", $output); | |||||
// TODO: Test the verification utility error conditions | |||||
} | |||||
} |