-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,31 @@ public function testCreateNotUniqueName(): void | |
$this->assertNull($user); | ||
} | ||
|
||
public function testCreatePasswordNotMatch(): void | ||
{ | ||
$user = $this->createUser([ | ||
'username' => 'user1', | ||
'email' => '[email protected]', | ||
'password' => 'secret123', | ||
]); | ||
|
||
$this->setMockIo([ | ||
'password', | ||
'badpassword', | ||
]); | ||
|
||
command('shield:user create -n user1 -e [email protected]'); | ||
|
||
$this->assertStringContainsString( | ||
"The passwords don't match", | ||
$this->io->getFirstOutput() | ||
); | ||
|
||
$users = model(UserModel::class); | ||
$user = $users->findByCredentials(['email' => '[email protected]']); | ||
$this->assertNull($user); | ||
} | ||
|
||
/** | ||
* Create an active user. | ||
*/ | ||
|
@@ -321,6 +346,28 @@ public function testDeleteById(): void | |
$this->assertNull($user); | ||
} | ||
|
||
public function testDeleteUserNotExist(): void | ||
{ | ||
$this->createUser([ | ||
'username' => 'user6', | ||
'email' => '[email protected]', | ||
'password' => 'secret123', | ||
]); | ||
|
||
$this->setMockIo(['y']); | ||
|
||
command('shield:user delete -n userx'); | ||
|
||
$this->assertStringContainsString( | ||
"User doesn't exist", | ||
$this->io->getLastOutput() | ||
); | ||
|
||
$users = model(UserModel::class); | ||
$user = $users->findByCredentials(['email' => '[email protected]']); | ||
$this->assertNotNull($user); | ||
} | ||
|
||
public function testPassword(): void | ||
{ | ||
$this->createUser([ | ||
|