Skip to content

Commit

Permalink
test: add test for addgroup cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 16, 2023
1 parent d7c2f7b commit 8ead772
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Commands/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,28 @@ public function testAddgroup(): void
$this->assertTrue($user->inGroup('admin'));
}

public function testAddgroupCancel(): void
{
$this->createUser([
'username' => 'user10',
'email' => 'user10@example.com',
'password' => 'secret123',
]);

$this->setMockIo(['n']);

command('shield:user addgroup -n user10 -g admin');

$this->assertStringContainsString(
'Addition of the user "user10" to the group "admin" cancelled',
$this->io->getLastOutput()
);

$users = model(UserModel::class);
$user = $users->findByCredentials(['email' => 'user10@example.com']);
$this->assertFalse($user->inGroup('admin'));
}

public function testRemovegroup(): void
{
$this->createUser([
Expand Down

0 comments on commit 8ead772

Please sign in to comment.