-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Processing of sessions and cookies is prepared
- Loading branch information
1 parent
b0cd5d6
commit 846c27a
Showing
3 changed files
with
86 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use LaravelLang\Config\Facades\Config; | ||
use Tests\Constants\LocaleValue; | ||
|
||
use function Pest\Laravel\withCookie; | ||
|
||
test('main locale', function (string $locale) { | ||
withCookie(Config::shared()->routes->names->cookie, $locale) | ||
->getJson(route('via.cookie')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationFrench); | ||
})->with('main-locales'); | ||
|
||
test('aliased locale', function (string $locale) { | ||
withCookie(Config::shared()->routes->names->cookie, $locale) | ||
->getJson(route('via.cookie')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationGerman); | ||
})->with('aliased-locales'); | ||
|
||
test('empty locale', function (int|string|null $locale) { | ||
withCookie(Config::shared()->routes->names->cookie, $locale) | ||
->getJson(route('via.cookie')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationFrench); | ||
})->with('empty-locales'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use LaravelLang\Config\Facades\Config; | ||
use Tests\Constants\LocaleValue; | ||
|
||
use function Pest\Laravel\withSession; | ||
|
||
test('main locale', function (string $locale) { | ||
withSession([Config::shared()->routes->names->session => $locale]) | ||
->getJson(route('via.session')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationFrench); | ||
})->with('main-locales'); | ||
|
||
test('aliased locale', function (string $locale) { | ||
withSession([Config::shared()->routes->names->session => $locale]) | ||
->getJson(route('via.session')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationGerman); | ||
})->with('aliased-locales'); | ||
|
||
test('empty locale', function (int|string|null $locale) { | ||
withSession([Config::shared()->routes->names->session => $locale]) | ||
->getJson(route('via.session')) | ||
->assertSuccessful() | ||
->assertJsonPath('message', LocaleValue::TranslationFrench); | ||
})->with('empty-locales'); |