-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot feature test multilanguage routes #113
Comments
Additional: I've noticed that $this->get('/') will result in a 302 redirect (as expected), but both $this->followingsRedirects()->get('/')
$this->get('/en') result in a 404. |
This package needs a rewrite because the localized routes are registered dynamically based on different factors. I'm aware about this issue and i need time to rewrite it to make it easy to test (with trait helpers). Also make the localized routes cachable. These are some related issues:
|
@arcanedev-maroc are there any updates on this? |
I just bumped into this also. Any news regarding this issue? Tks |
Ok, i used this approach and it works :) |
Came around the same. |
Did anyone solve it? Expected status code 200 but received 302. |
|
This sould be the accepted answer. Following that answer, this is how I resolved. First modifiy 'hide-default-in-url' => env('LOCALIZATION_HIDE_DEFAULT_LOCALE', false), If you don't use English as your default language you need to override 'locale' => env('DEFAULT_LOCALE', 'es'), Then add to your phpunit.xml this valus inside the <env name="DEFAULT_LOCALE" value="en"/>
<env name="LOCALIZATION_HIDE_DEFAULT_LOCALE" value="true"/> Now remember to use always english for your routes in tests. Your tests should work 😄 |
Description:
I cannot test multilanguage translated routes. Created routes work in the browser, but never in a testcase. Tried it using a empty Laravel-project, which doesn't work either. I'd like to start a PR, but I have no clue where to start at this point in time.
Steps To Reproduce:
composer require "arcanedev/localization:^2.1"
php artisan vendor:publish --provider="Arcanedev\Localization\LocalizationServiceProvider"
routes/web.php
to:tests/Feature/ExampleTest.php
to:vendor/bin/phpunit
.Expected
No changes in the testcase
Happened
The text was updated successfully, but these errors were encountered: