-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDisableTest.php
More file actions
48 lines (37 loc) · 1.11 KB
/
DisableTest.php
File metadata and controls
48 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Tests\Commands;
use App\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
class DisableTest extends TestCase {
use DatabaseTransactions;
const EMAIL = 'mail@example.com';
private function createUser($email) {
$user = new User([
'email' => $email,
'password' => 'worldsstrongestpassword',
]);
$user->save();
return $user;
}
public function testSuccess() {
$oldUser = $this->createUser(self::EMAIL);
$oldUserId = $oldUser->id;
$this->artisan('wbs-user:disable',
[
'--email' => self::EMAIL,
]
)->assertExitCode(0);
$newUser = User::firstWhere('id', $oldUserId);
$this->assertSame($oldUser->id, $newUser->id);
$this->assertSame($newUser->email, '');
$this->assertFalse($newUser->hasVerifiedEmail());
}
public function testUserNotFound() {
$this->artisan('wbs-user:disable',
[
'--email' => self::EMAIL,
]
)->assertExitCode(2);
}
}