When I tried to test my controller with PHPUnit, it throws an error: Spiral\Translator\Exception\LocaleException: Undefined locale '' in //Data/Dev/spiral/vendor/spiral/translator/src/Translator.php at line 72
This is caused by the LocaleSelector middleware. It detects the client's locale by the 'accept-language' line in headers of the request.
When the request headers don't have 'accept-language', it will call:
$this->translator->setLocale('');
Reproducible Steps
create a new project with `composer create-project
Bug description
When I tried to test my controller with PHPUnit, it throws an error:
Spiral\Translator\Exception\LocaleException: Undefined locale '' in //Data/Dev/spiral/vendor/spiral/translator/src/Translator.php at line 72
This is caused by the
LocaleSelector
middleware. It detects the client's locale by the 'accept-language' line in headers of the request.When the request headers don't have 'accept-language', it will call:
$this->translator->setLocale('');
Reproducible Steps