Skip to content

Commit a987769

Browse files
committed
Added tests
1 parent c167bf9 commit a987769

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Tests\Commands;
4+
5+
use App\User;
6+
use Illuminate\Foundation\Testing\RefreshDatabase;
7+
use Tests\TestCase;
8+
9+
class CheckUserEmailExistTest extends TestCase {
10+
11+
public function testItFindsEmailInApidbUsersTable() {
12+
User::factory()->create([
13+
'email' => 'user@example.com',
14+
]);
15+
16+
// Act & Assert
17+
$this->artisan('wbs-user:check-email', ['emails' => ['user@example.com']])
18+
->expectsOutput('FOUND: user@example.com in apidb.users')
19+
->assertExitCode(0);
20+
}
21+
22+
public function testItReturnsNotFoundIfEmailDoesNotExist() {
23+
$this->artisan('wbs-user:check-email', ['emails' => ['nonexistent@example.com']])
24+
->expectsOutput('NOT FOUND: nonexistent@example.com')
25+
->assertExitCode(0);
26+
}
27+
}

0 commit comments

Comments
 (0)