Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Authenticator/AuthenticationRequiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Authentication\Authenticator;

use Cake\Http\Exception\HttpException;
use function Cake\I18n\__d;

/**
* An exception for stateless authenticators when credentials are wrong/missing.
Expand Down Expand Up @@ -45,7 +46,7 @@ class AuthenticationRequiredException extends HttpException
*/
public function __construct(array $headers, string $body = '', int $code = 401)
{
parent::__construct('Authentication is required to continue', $code);
parent::__construct(__d('authentication', 'Authentication is required to continue'), $code);
$this->headers = $headers;
$this->body = $body;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Authenticator/UnauthenticatedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Cake\Http\Exception\HttpException;
use Throwable;
use function Cake\I18n\__d;

/**
* An exception that signals that authentication was required but missing.
Expand All @@ -38,7 +39,7 @@ class UnauthenticatedException extends HttpException
public function __construct(string $message = '', int $code = 401, ?Throwable $previous = null)
{
if (!$message) {
$message = 'Authentication is required to continue';
$message = __d('authentication', 'Authentication is required to continue');
}
parent::__construct($message, $code, $previous);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

use Authentication\Plugin as AuthenticationPlugin;
use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Datasource\ConnectionManager;
Expand Down Expand Up @@ -54,6 +55,12 @@
],
]);

Cache::setConfig([
'_cake_translations_' => [
'engine' => 'Array',
],
]);

if (!getenv('DB_URL')) {
putenv('DB_URL=sqlite:///:memory:');
}
Expand Down
Loading