Converted MissingAuthenticationException into a problem details exception

This commit is contained in:
Alejandro Celaya
2019-11-26 21:43:29 +01:00
parent f502eb0195
commit 6f4e5175da
8 changed files with 48 additions and 57 deletions

View File

@@ -11,7 +11,7 @@ use Shlinkio\Shlink\Rest\Authentication\Plugin\ApiKeyHeaderPlugin;
use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthenticationPluginInterface;
use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthorizationHeaderPlugin;
use Shlinkio\Shlink\Rest\Authentication\RequestToHttpAuthPlugin;
use Shlinkio\Shlink\Rest\Exception\NoAuthenticationException;
use Shlinkio\Shlink\Rest\Exception\MissingAuthenticationException;
use Zend\Diactoros\ServerRequest;
use function implode;
@@ -35,7 +35,7 @@ class RequestToAuthPluginTest extends TestCase
{
$request = new ServerRequest();
$this->expectException(NoAuthenticationException::class);
$this->expectException(MissingAuthenticationException::class);
$this->expectExceptionMessage(sprintf(
'None of the valid authentication mechanisms where provided. Expected one of ["%s"]',
implode('", "', RequestToHttpAuthPlugin::SUPPORTED_AUTH_HEADERS)