forked from Laravel-Lang/locales
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
859a42a
commit 7bc623f
Showing
34 changed files
with
634 additions
and
626 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
File renamed without changes.
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
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
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
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
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
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
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
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,38 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "laravel-Lang/locales" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <[email protected]> | ||
* @copyright 2023 Laravel Lang Team | ||
* @license MIT | ||
* | ||
* @see https://laravel-lang.com | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use LaravelLang\Locales\Enums\Locale; | ||
use LaravelLang\Locales\Facades\Locales; | ||
|
||
it('checks the list of available locales') | ||
->expect(Locales::available()) | ||
->toBeArray() | ||
->toBeIn([Locale::English->value]) | ||
->not->toBeIn(['foo', 'bar']); | ||
|
||
it('checks the list of available locales taking into account aliases', function (Locale $locale, string $alias) { | ||
setAlias($locale, $alias); | ||
|
||
expect(Locales::available()) | ||
->toBeArray() | ||
->toBeIn([$alias]) | ||
->not->toBeIn([$locale->value]); | ||
})->with('aliased-locales'); | ||
|
||
it('checks incorrect locales against the list of available ones', function (?string $locale) { | ||
expect(Locales::available())->toBeArray()->not->toBeIn([$locale]); | ||
})->with('incorrect-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,54 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "laravel-Lang/locales" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <[email protected]> | ||
* @copyright 2023 Laravel Lang Team | ||
* @license MIT | ||
* | ||
* @see https://laravel-lang.com | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use LaravelLang\Locales\Enums\Locale; | ||
use LaravelLang\Locales\Facades\Locales; | ||
|
||
it('returns English locale') | ||
->expect(Locales::getDefault()) | ||
->toBe(Locale::English->value); | ||
|
||
it('returns German locale', function () { | ||
setLocales(main: Locale::German); | ||
|
||
expect(Locales::getDefault()) | ||
->toBe(Locale::German->value); | ||
}); | ||
|
||
it('returns English locale if the main one is specified incorrectly', function () { | ||
setLocales(main: 'foo'); | ||
|
||
expect(Locales::getDefault()) | ||
->toBe(Locale::English->value); | ||
}); | ||
|
||
it('returns English locale if primary and fallback are incorrect', function () { | ||
setLocales('foo', 'foo'); | ||
|
||
expect(Locales::getDefault()) | ||
->toBe(Locale::English->value); | ||
}); | ||
|
||
it('will return the locale by alias', function (Locale $locale, string $alias) { | ||
setLocales($locale); | ||
|
||
setAlias($locale, $alias); | ||
|
||
expect(Locales::getDefault()) | ||
->toBe($alias) | ||
->not->toBe($locale->value); | ||
})->with('aliased-locales'); |
Oops, something went wrong.