-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from etibarrustam/exclude_languages
Exclude languages
- Loading branch information
Showing
9 changed files
with
108 additions
and
11 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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Exclude Languages | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This configuration option allows you to exclude specific languages from | ||
| being processed or checked. The array contains the language codes that | ||
| should be excluded from the language lists. | ||
| | ||
| Example: ['en-ca', 'en-us'] | ||
| | ||
*/ | ||
'exclude_languages' => [], | ||
]; | ||
|
||
|
||
|
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
42 changes: 42 additions & 0 deletions
42
tests/Tests/Unit/Console/Commands/CheckExcludedLanguagesTest.php
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,42 @@ | ||
<?php | ||
|
||
namespace Larswiegers\LaravelTranslationsChecker\Tests\Tests\Unit\Console\Commands; | ||
|
||
use Tests\TestCase; | ||
|
||
class CheckExcludedLanguagesTest extends TestCase | ||
{ | ||
private string $languagesDir = 'tests/resources/lang/exclude_langs'; | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* Test excluded languages. | ||
* @return void | ||
*/ | ||
public function testTheCommandShouldNotProduceAnErrorIfOtherLangsExcluded() | ||
{ | ||
config()->set('translations-checker.exclude_languages', ['fr', 'ga']); | ||
|
||
$command = $this->artisan('translations:check', [ | ||
'--directory' => $this->languagesDir | ||
]); | ||
|
||
$command->assertExitCode(0); | ||
} | ||
|
||
/** | ||
* Test without exclusion. | ||
* @return void | ||
*/ | ||
public function testTheCommandShouldThrowAnErrorIfOtherLangsNotExcluded() | ||
{ | ||
$command = $this->artisan('translations:check', [ | ||
'--directory' => $this->languagesDir | ||
]); | ||
|
||
$command->assertExitCode(1); | ||
} | ||
} |
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,5 @@ | ||
<?php | ||
|
||
return [ | ||
'test_key' => 'test_value', | ||
]; |
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,5 @@ | ||
<?php | ||
|
||
return [ | ||
'test_key_fr' => 'test_value_fr', | ||
]; |
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,5 @@ | ||
<?php | ||
|
||
return [ | ||
'test_key_ga' => 'test_value_ga', | ||
]; |