function LoginCommandTest::testBlockedUser
Tests trying to get a login link for a blocked user.
File
-
core/
modules/ user/ tests/ src/ Kernel/ Command/ LoginCommandTest.php, line 49
Class
- LoginCommandTest
- Tests user:login console command failure modes (blocked, user not found).
Namespace
Drupal\Tests\user\Kernel\CommandCode
public function testBlockedUser() : void {
$blockedUser = $this->createUser();
$blockedUser->block()
->save();
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("Account {$blockedUser->getAccountName()} is blocked and thus cannot login.");
$tester = $this->buildLoginCommandTester();
$tester->execute([
'--uid' => $blockedUser->id(),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.