mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-08 22:03:16 +01:00
41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Exceptions;
|
|
|
|
use App\Exceptions\Handler;
|
|
use League\OAuth2\Server\Exception\OAuthServerException;
|
|
use RuntimeException;
|
|
use Tests\TestCase;
|
|
|
|
class HandlerTest extends TestCase
|
|
{
|
|
public function test_oauth_access_denied_exceptions_are_not_reported(): void
|
|
{
|
|
// Arrange
|
|
$exception = OAuthServerException::accessDenied(
|
|
'Access token could not be verified',
|
|
previous: new RuntimeException('The token is expired')
|
|
);
|
|
|
|
// Act
|
|
$shouldReport = app(Handler::class)->shouldReport($exception);
|
|
|
|
// Assert
|
|
$this->assertFalse($shouldReport);
|
|
}
|
|
|
|
public function test_operational_oauth_exceptions_are_reported(): void
|
|
{
|
|
// Arrange
|
|
$exception = OAuthServerException::serverError('Signing key could not be read');
|
|
|
|
// Act
|
|
$shouldReport = app(Handler::class)->shouldReport($exception);
|
|
|
|
// Assert
|
|
$this->assertTrue($shouldReport);
|
|
}
|
|
}
|