-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(test): add integration test for Users::executeActionsEmail()
- Loading branch information
Showing
3 changed files
with
11 additions
and
3 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
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
use Fschmtt\Keycloak\Representation\Role; | ||
use Fschmtt\Keycloak\Representation\User; | ||
use Fschmtt\Keycloak\Test\Integration\IntegrationTestBehaviour; | ||
use GuzzleHttp\Exception\ServerException; | ||
use PHPUnit\Framework\TestCase; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
|
@@ -195,13 +196,20 @@ public function testExecuteActionsEmail(): void | |
$username = Uuid::uuid4()->toString(); | ||
|
||
$users->create('master', new User( | ||
email: '[email protected]', | ||
enabled: true, | ||
username: $username, | ||
)); | ||
|
||
$user = $this->searchUserByUsername($username); | ||
static::assertInstanceOf(User::class, $user); | ||
|
||
$users->executeActionsEmail('master', $user->getId(), ['UPDATE_PASSWORD']); | ||
try { | ||
$users->executeActionsEmail('master', $user->getId(), ['UPDATE_PASSWORD']); | ||
} catch (ServerException $e) { | ||
static::assertSame(500, $e->getResponse()->getStatusCode()); | ||
static::assertStringContainsString('Failed to send execute actions email', $e->getResponse()->getBody()->getContents()); | ||
} | ||
|
||
$users->delete('master', $user->getId()); | ||
|
||
|
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