Skip to content

Commit

Permalink
TEST: unsuccessful oauth token request
Browse files Browse the repository at this point in the history
  • Loading branch information
krsriq committed Sep 28, 2023
1 parent a498c6a commit 6a456ec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/Unit/ZoomApiAccessTokenFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ public function invalidConfigurationWillThrowException(): void
$factoryMock->initializeObject();
}

/** @test */
public function unsuccessfulRequestThrowsZoomApiException(): void
{
$this->expectException(ZoomApiException::class);
$this->expectExceptionMessage('Could not fetch Zoom access token. Please check the settings for account ID, client ID and client secret, as well as your Zoom app.');

$handlerStack = HandlerStack::create(
new MockHandler([
new Response(400)
])
);
$factoryMock = $this->getFactory($handlerStack);


$factoryMock->createFromConfiguration();
}

private function getFactory(HandlerStack $handlerStack = null): ZoomApiAccessTokenFactory|MockObject
{
$factory = $this->getAccessibleMock(ZoomApiAccessTokenFactory::class, ['buildClient'], [], '', false);
Expand Down

0 comments on commit 6a456ec

Please sign in to comment.